From: Lennart Poettering Date: Thu, 8 Dec 2016 18:35:05 +0000 (+0100) Subject: util-lib: make sure fd_check_fstype() opens files with O_CLOEXEC X-Git-Tag: v233~237^2~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=08cea7dfc0aee044c35f234579a9f4fa8edcace5;p=thirdparty%2Fsystemd.git util-lib: make sure fd_check_fstype() opens files with O_CLOEXEC Also, O_NOCTTY is a safer bet, let's add that too. --- diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c index 5663a29cd65..848572687e2 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;