From: Serge Hallyn Date: Sat, 8 Mar 2014 02:39:14 +0000 (-0600) Subject: check netnsfd before closing X-Git-Tag: lxc-1.1.0.alpha1~222 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b2f98f5f8db51d481beeb8bd21764927e6b2604;p=thirdparty%2Flxc.git check netnsfd before closing Signed-off-by: Serge Hallyn --- diff --git a/src/lxc/start.c b/src/lxc/start.c index 68982db40..6b57ee119 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -1058,7 +1058,8 @@ int __lxc_start(const char *name, struct lxc_conf *conf, err = lxc_poll(name, handler); if (err) { ERROR("mainloop exited with an error"); - close(netnsfd); + if (netnsfd >= 0) + close(netnsfd); goto out_abort; } @@ -1090,7 +1091,8 @@ int __lxc_start(const char *name, struct lxc_conf *conf, } lxc_rename_phys_nics_on_shutdown(netnsfd, handler->conf); - close(netnsfd); + if (netnsfd >= 0) + close(netnsfd); if (handler->pinfd >= 0) { close(handler->pinfd);