conf: use O_CLOEXEC in lxc_pivot_root()

parent 8e64138c
...@@ -1472,13 +1472,13 @@ static int lxc_pivot_root(const char *rootfs) ...@@ -1472,13 +1472,13 @@ static int lxc_pivot_root(const char *rootfs)
int oldroot; int oldroot;
int newroot = -1, ret = -1; int newroot = -1, ret = -1;
oldroot = open("/", O_DIRECTORY | O_RDONLY); oldroot = open("/", O_DIRECTORY | O_RDONLY | O_CLOEXEC);
if (oldroot < 0) { if (oldroot < 0) {
SYSERROR("Failed to open old root directory"); SYSERROR("Failed to open old root directory");
return -1; return -1;
} }
newroot = open(rootfs, O_DIRECTORY | O_RDONLY); newroot = open(rootfs, O_DIRECTORY | O_RDONLY | O_CLOEXEC);
if (newroot < 0) { if (newroot < 0) {
SYSERROR("Failed to open new root directory"); SYSERROR("Failed to open new root directory");
goto on_error; goto on_error;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment