OSDN Git Service
(root)
/
android-x86
/
external-musl-libc.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
d238ed0
..
2b84649
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);