summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-12-08 19:35:05 +0100
committerLennart Poettering <lennart@poettering.net>2016-12-20 20:00:09 +0100
commit08cea7dfc0aee044c35f234579a9f4fa8edcace5 (patch)
tree597c7d7711eefe60fce57904772f898f52f88313
parenteee8b7ab2e701a3e9e4b71b80ddf6f0fb77e029b (diff)
util-lib: make sure fd_check_fstype() opens files with O_CLOEXEC
Also, O_NOCTTY is a safer bet, let's add that too.
-rw-r--r--src/basic/stat-util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c
index 5663a29cd6..848572687e 100644
--- a/src/basic/stat-util.c
+++ b/src/basic/stat-util.c
@@ -204,7 +204,7 @@ int fd_check_fstype(int fd, statfs_f_type_t magic_value) {
int path_check_fstype(const char *path, statfs_f_type_t magic_value) {
_cleanup_close_ int fd = -1;
- fd = open(path, O_RDONLY);
+ fd = open(path, O_RDONLY|O_CLOEXEC|O_NOCTTY);
if (fd < 0)
return -errno;