]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
rootfs pin: fix two bugs
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Mon, 11 Mar 2013 03:42:40 +0000 (22:42 -0500)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Mon, 11 Mar 2013 13:42:11 +0000 (08:42 -0500)
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>
src/lxc/conf.c
src/lxc/start.c

index add3c7406506be65775472dc95d98a915c60e240..97b4ae4a417857088c37fb3011b767acd4b06c43 100644 (file)
@@ -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);
index f0e82a340c962fbf5de8fa4e966a2a75d692527d..3fdfa0479409ffb763cea1f83d8f3dfa01a0d25b 100644 (file)
@@ -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