summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJo-Philipp Wich2016-05-17 15:42:11 +0000
committerJohn Crispin2016-05-17 08:40:48 +0000
commit1418c6ce8559ea125c525c2663105fa5ff14905e (patch)
tree291f487ffa169a39bd2fae864dcd4b5cf9633019
parentf2c77756933f22981c1202c039e7f7e24d7247f3 (diff)
downloadprocd-1418c6ce8559ea125c525c2663105fa5ff14905e.tar.gz
utils: use O_PATH when opening /dev
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>
-rw-r--r--utils/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/utils/utils.c b/utils/utils.c
index ebf5447..e2e3396 100644
--- 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_RDONLY);
+ dfd = open("/dev", O_PATH|O_DIRECTORY);
if (dfd < 0)
return -1;