From: Christian Brauner Date: Mon, 9 Dec 2019 10:20:29 +0000 (+0100) Subject: file_utils: use O_NOCTTY | O_NOFOLLOW X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=afb9722c7fbd5d0d7146f13c8ce70a3e014de484;p=thirdparty%2Flxc.git file_utils: use O_NOCTTY | O_NOFOLLOW Signed-off-by: Christian Brauner --- diff --git a/src/lxc/file_utils.c b/src/lxc/file_utils.c index 3b0e1ea92..aac92fe91 100644 --- a/src/lxc/file_utils.c +++ b/src/lxc/file_utils.c @@ -44,7 +44,8 @@ int lxc_writeat(int dirfd, const char *filename, const void *buf, size_t count) __do_close_prot_errno int fd = -EBADF; ssize_t ret; - fd = openat(dirfd, filename, O_WRONLY | O_CLOEXEC); + fd = openat(dirfd, filename, + O_WRONLY | O_CLOEXEC | O_NOCTTY | O_NOFOLLOW); if (fd < 0) return -1; @@ -60,7 +61,7 @@ int lxc_write_openat(const char *dir, const char *filename, const void *buf, { __do_close_prot_errno int dirfd = -EBADF; - dirfd = open(dir, O_DIRECTORY | O_RDONLY | O_CLOEXEC); + dirfd = open(dir, O_DIRECTORY | O_RDONLY | O_CLOEXEC | O_NOCTTY | O_NOFOLLOW); if (dirfd < 0) return -1;