Skip to content

Commit 0bfda95

Browse files
committed
src/util: Fix compatibility with glibc 2.33 and higher
From `man 3 errno`: The value in errno is significant only when the return value of the call indicated an error. Any code using this failed with: "realpath failed: Invalid argument"
1 parent 5601657 commit 0bfda95

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/util/file_util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ std::string get_current_working_directory()
5454
errno=0;
5555
char *wd=realpath(".", nullptr);
5656

57-
if(wd == nullptr || errno != 0)
57+
if(wd == nullptr)
5858
throw system_exceptiont(
5959
std::string("realpath failed: ") + std::strerror(errno));
6060

src/util/tempdir.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ std::string get_temporary_directory(const std::string &name_template)
9393
errno = 0;
9494
char *wd = realpath(td, nullptr);
9595

96-
if(wd == nullptr || errno != 0)
96+
if(wd == nullptr)
9797
throw system_exceptiont(
9898
std::string("realpath failed: ") + std::strerror(errno));
9999

0 commit comments

Comments
 (0)