File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change 11// SPDX-License-Identifier: LGPL-3.0-only
22#include < cstring>
33#include < climits>
4+ #include < filesystem>
45#include < unistd.h>
56
67#include < sys/stat.h>
@@ -60,15 +61,10 @@ static std::string get_tmpdir(void)
6061 if (is_writable_dir (" /var/tmp" ))
6162 return " /var/tmp" ;
6263
63- int old_errno = errno;
64- char *workdir = get_current_dir_name ();
65- errno = old_errno;
66- if (workdir != nullptr ) {
67- std::string wdir_str (workdir);
68- free (workdir);
69- if (is_writable_dir (workdir))
70- return workdir;
71- }
64+ std::string workdir = std::filesystem::current_path ();
65+
66+ if (is_writable_dir (workdir))
67+ return workdir;
7268
7369 LOG (FATAL) << " Unable to get temporary directory." ;
7470 std::abort ();
Original file line number Diff line number Diff line change 11// SPDX-License-Identifier: LGPL-3.0-only
22#include < algorithm>
33#include < iostream>
4+ #include < filesystem>
45#include < fstream>
56#include < memory>
67#include < sstream>
@@ -322,7 +323,7 @@ std::string make_absolute(const std::string &path)
322323 if (path.empty () || path[0 ] == ' /' )
323324 return path;
324325
325- return std::string ( get_current_dir_name ()) + ' / ' + path;
326+ return std::filesystem::current_path () / path;
326327}
327328
328329std::optional<Rule> parse_rule_arg (size_t rulepos, const std::string &arg)
You can’t perform that action at this time.
0 commit comments