]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
check netnsfd before closing
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Sat, 8 Mar 2014 02:39:14 +0000 (20:39 -0600)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Sat, 8 Mar 2014 02:39:14 +0000 (20:39 -0600)
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/start.c

index 68982db40856b288cbf2239f245329a51840b97a..6b57ee11943a2c83a6117c14a6fca4e0ca712a41 100644 (file)
@@ -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);