From: Otto Date: Mon, 29 Mar 2021 10:05:55 +0000 (+0200) Subject: namespace filesystem = boost::filesystem X-Git-Tag: dnsdist-1.6.0-rc1~46^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dec872ee807caa32eab6f75e36db4feb16f2f6ea;p=thirdparty%2Fpdns.git namespace filesystem = boost::filesystem --- diff --git a/pdns/nod.cc b/pdns/nod.cc index 63733a65fc..45d295e27e 100644 --- a/pdns/nod.cc +++ b/pdns/nod.cc @@ -34,7 +34,7 @@ #include "misc.hh" using namespace nod; -using namespace boost::filesystem; +namespace filesystem = boost::filesystem; // PersistentSBF Implementation @@ -42,10 +42,10 @@ std::mutex PersistentSBF::d_cachedir_mutex; void PersistentSBF::remove_tmp_files() { - path p(d_cachedir); + filesystem::path p(d_cachedir); Regex file_regex(d_prefix + ".*\\." + bf_suffix + "\\.[[:xdigit:]]{8}$"); - for (directory_iterator i(p); i != directory_iterator(); ++i) { - if (is_regular_file(i->path()) && file_regex.match(i->path().filename().string())) { + for (filesystem::directory_iterator i(p); i != filesystem::directory_iterator(); ++i) { + if (filesystem::is_regular_file(i->path()) && file_regex.match(i->path().filename().string())) { remove(*i); } } @@ -62,15 +62,15 @@ bool PersistentSBF::init(bool ignore_pid) { std::lock_guard lock(d_cachedir_mutex); if (d_cachedir.length()) { - path p(d_cachedir); + filesystem::path p(d_cachedir); try { if (exists(p) && is_directory(p)) { remove_tmp_files(); - path newest_file; + filesystem::path newest_file; std::time_t newest_time=time(nullptr); Regex file_regex(d_prefix + ".*\\." + bf_suffix + "$"); - for (directory_iterator i(p); i!=directory_iterator(); ++i) { - if (is_regular_file(i->path()) && + for (filesystem::directory_iterator i(p); i != filesystem::directory_iterator(); ++i) { + if (filesystem::is_regular_file(i->path()) && file_regex.match(i->path().filename().string())) { if (ignore_pid || (i->path().filename().string().find(std::to_string(getpid())) == std::string::npos)) { @@ -83,7 +83,7 @@ bool PersistentSBF::init(bool ignore_pid) { } } } - if (exists(newest_file)) { + if (filesystem::exists(newest_file)) { std::string filename = newest_file.string(); std::ifstream infile; try { @@ -105,7 +105,7 @@ bool PersistentSBF::init(bool ignore_pid) { } } } - catch (const filesystem_error& e) { + catch (const filesystem::filesystem_error& e) { g_log<