From: Serge Hallyn Date: Mon, 11 Mar 2013 03:42:40 +0000 (-0500) Subject: rootfs pin: fix two bugs X-Git-Tag: lxc-0.9.0.rc1~2^2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d03360a77521d7af4f177e195f6119c36d4c31d;p=thirdparty%2Flxc.git 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 Acked-by: David Ward --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index add3c7406..97b4ae4a4 100644 --- a/src/lxc/conf.c +++ b/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); diff --git a/src/lxc/start.c b/src/lxc/start.c index f0e82a340..3fdfa0479 100644 --- a/src/lxc/start.c +++ b/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