Commit 0d03360a by Serge Hallyn

rootfs pin: fix two bugs

1. if there's no rootfs, return -2, not 0. 2. don't close pinfd unconditionally in do_start(). Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com> Acked-by: 's avatarDavid Ward <david.ward@ll.mit.edu>
parent 90341b9e
...@@ -578,7 +578,7 @@ int pin_rootfs(const char *rootfs) ...@@ -578,7 +578,7 @@ int pin_rootfs(const char *rootfs)
int ret, fd; int ret, fd;
if (rootfs == NULL || strlen(rootfs) == 0) if (rootfs == NULL || strlen(rootfs) == 0)
return 0; return -2;
if (!realpath(rootfs, absrootfs)) { if (!realpath(rootfs, absrootfs)) {
SYSERROR("failed to get real path for '%s'", rootfs); SYSERROR("failed to get real path for '%s'", rootfs);
......
...@@ -620,7 +620,8 @@ static int do_start(void *data) ...@@ -620,7 +620,8 @@ static int do_start(void *data)
lxc_sync_fini_parent(handler); lxc_sync_fini_parent(handler);
/* don't leak the pinfd to the container */ /* don't leak the pinfd to the container */
close(handler->pinfd); if (handler->pinfd >= 0)
close(handler->pinfd);
/* Tell the parent task it can begin to configure the /* Tell the parent task it can begin to configure the
* container and wait for it to finish * container and wait for it to finish
......
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