diff options
author | Rich Felker <dalias@aerifal.cx> | 2013-08-31 15:44:58 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2013-08-31 15:44:58 -0400 |
commit | 27b4923ba00f0a7511c7ebf5f19313d6313052e9 (patch) | |
tree | 30d54effafffe4e92f73aa91bb1dc5f5d25dbb1d /src | |
parent | 9ff8ed463caa86cb5e81419d8eb3bfb56e90f03c (diff) | |
download | musl-27b4923ba00f0a7511c7ebf5f19313d6313052e9.tar.gz musl-27b4923ba00f0a7511c7ebf5f19313d6313052e9.tar.bz2 musl-27b4923ba00f0a7511c7ebf5f19313d6313052e9.tar.xz musl-27b4923ba00f0a7511c7ebf5f19313d6313052e9.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/misc/realpath.c | 2 |
1 files changed, 1 insertions, 1 deletions
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); |