From: Rich Felker Date: Sat, 31 Aug 2013 19:44:58 +0000 (-0400) Subject: make realpath use O_PATH when opening the file X-Git-Tag: v0.9.14~56 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=27b4923ba00f0a7511c7ebf5f19313d6313052e9;p=oweals%2Fmusl.git make realpath use O_PATH when opening the file this avoids failure if the file is not readable and avoids odd behavior for device nodes, etc. on old kernels that lack O_PATH, the old behavior (O_RDONLY) will naturally happen as the fallback. --- diff --git a/src/misc/realpath.c b/src/misc/realpath.c index d238ed01..2b846497 100644 --- a/src/misc/realpath.c +++ b/src/misc/realpath.c @@ -21,7 +21,7 @@ char *realpath(const char *restrict filename, char *restrict resolved) return 0; } - fd = open(filename, O_RDONLY|O_NONBLOCK|O_CLOEXEC); + fd = open(filename, O_PATH|O_NONBLOCK|O_CLOEXEC); if (fd < 0) return 0; __procfdname(buf, fd);