Skip to content
Browse files

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: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: David Ward <david.ward@ll.mit.edu>
  • Loading branch information...
1 parent 90341b9 commit 0d03360a77521d7af4f177e195f6119c36d4c31d @hallyn hallyn committed
Showing with 3 additions and 2 deletions.
  1. +1 −1 src/lxc/conf.c
  2. +2 −1 src/lxc/start.c
View
2 src/lxc/conf.c
@@ -578,7 +578,7 @@ int pin_rootfs(const char *rootfs)
int ret, fd;
if (rootfs == NULL || strlen(rootfs) == 0)
- return 0;
+ return -2;
if (!realpath(rootfs, absrootfs)) {
SYSERROR("failed to get real path for '%s'", rootfs);
View
3 src/lxc/start.c
@@ -620,7 +620,8 @@ static int do_start(void *data)
lxc_sync_fini_parent(handler);
/* 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
* container and wait for it to finish

0 comments on commit 0d03360

Please sign in to comment.
Something went wrong with that request. Please try again.