]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-start: close inherited fds right before exec
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 14 Feb 2014 22:23:24 +0000 (23:23 +0100)
committerStéphane Graber <stgraber@ubuntu.com>
Sat, 15 Feb 2014 00:12:32 +0000 (19:12 -0500)
Not before we've even forked.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/start.c

index 69e34861acb84b617849ff4aa42ff4dfe6dcdb58..81d3f47ccc3817679b263dc4a555465da4497dbf 100644 (file)
@@ -676,6 +676,9 @@ static int do_start(void *data)
 
        close(handler->sigfd);
 
+       if (lxc_check_inherited(handler->conf, -1))
+               return -1;
+
        /* after this call, we are in error because this
         * ops should not return as it execs */
        handler->ops->start(handler, handler->data);
@@ -1030,9 +1033,6 @@ int lxc_start(const char *name, char *const argv[], struct lxc_conf *conf,
                .argv = argv,
        };
 
-       if (lxc_check_inherited(conf, -1))
-               return -1;
-
        conf->need_utmp_watch = 1;
        return __lxc_start(name, conf, &start_ops, &start_arg, lxcpath);
 }