projects
/
oweals
/
procd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f2c7775
)
utils: use O_PATH when opening /dev
author
Jo-Philipp Wich
<jo@mein.io>
Tue, 17 May 2016 15:42:11 +0000
(17:42 +0200)
committer
John Crispin
<john@phrozen.org>
Tue, 17 May 2016 08:40:48 +0000
(10:40 +0200)
Use the O_PATH and O_DIRECTORY flags when opening the "/dev" path for the
subsequent openat() call to ensure that it is indeed a directory.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
utils/utils.c
patch
|
blob
|
history
diff --git
a/utils/utils.c
b/utils/utils.c
index ebf5447c8dad94245a91e1749e9f1887cd3f8c94..e2e33963f217dc3ccb0df25691b520103fb9a5f7 100644
(file)
--- a/
utils/utils.c
+++ b/
utils/utils.c
@@
-165,7
+165,7
@@
int patch_fd(const char *device, int fd, int flags)
device = "/dev/null";
if (*device != '/') {
- dfd = open("/dev", O_
RDONL
Y);
+ dfd = open("/dev", O_
PATH|O_DIRECTOR
Y);
if (dfd < 0)
return -1;