projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9ff8ed4
)
make realpath use O_PATH when opening the file
author
Rich Felker
<dalias@aerifal.cx>
Sat, 31 Aug 2013 19:44:58 +0000
(15:44 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Sat, 31 Aug 2013 19:44:58 +0000
(15:44 -0400)
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.
src/misc/realpath.c
patch
|
blob
|
history
diff --git
a/src/misc/realpath.c
b/src/misc/realpath.c
index d238ed014db44f70536079df3b3bc9f9262c99ce..2b84649716b4bc08f004b0707f6ed44f20c3aa5f 100644
(file)
--- 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);