From b056374891cea240ec4feb03ee715965800c1848 Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Fri, 7 Mar 2014 20:39:14 -0600 Subject: [PATCH] check netnsfd before closing Signed-off-by: Serge Hallyn --- src/lxc/start.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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); -- 2.47.2