We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6d1ff95 commit 525f41cCopy full SHA for 525f41c
src/base/fs_util.cc
@@ -62,12 +62,13 @@ self_path()
62
}
63
return std::nullopt;
64
#else
65
- char pathbuf[PATH_MAX];
66
- auto rc = readlink("/proc/self/exe", pathbuf, sizeof(pathbuf));
67
- if (rc > 0) {
68
- return std::filesystem::path(pathbuf);
+ std::error_code ec;
+ auto target = std::filesystem::read_symlink("/proc/self/exe", ec);
+ if (ec) {
+ log_error("failed to read /proc/self/exe: %s", ec.message().c_str());
69
+ return std::nullopt;
70
- return std::nullopt;
71
+ return target;
72
#endif
73
74
0 commit comments