From: Christian Brauner Date: Sat, 20 Oct 2018 09:35:41 +0000 (+0200) Subject: conf: use O_CLOEXEC in lxc_pivot_root() X-Git-Tag: lxc-3.1.0~29^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7806ebd74f88426ac88838224db74d157bad0f7c;p=thirdparty%2Flxc.git conf: use O_CLOEXEC in lxc_pivot_root() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index d1783aebd..c3358b2fe 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -1497,13 +1497,13 @@ static int lxc_pivot_root(const char *rootfs) int oldroot; int newroot = -1, ret = -1; - oldroot = open("/", O_DIRECTORY | O_RDONLY); + oldroot = open("/", O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (oldroot < 0) { SYSERROR("Failed to open old root directory"); return -1; } - newroot = open(rootfs, O_DIRECTORY | O_RDONLY); + newroot = open(rootfs, O_DIRECTORY | O_RDONLY | O_CLOEXEC); if (newroot < 0) { SYSERROR("Failed to open new root directory"); goto on_error;