]> git.proxmox.com Git - mirror_lxc.git/commitdiff
close fd 0 and 1 where not required
authorMichel Normand <NORMAND@fr.ibm.com>
Thu, 29 Apr 2010 08:03:58 +0000 (10:03 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Thu, 29 Apr 2010 08:03:58 +0000 (10:03 +0200)
the fd 0,1 and 2 are still inherited
and we only need the fd 2 (stderr) after
the start/restart of the application.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/lxc_init.c
src/lxc/start.c

index 05b429735aa76820ec37983fd5d0701b1a14e54e..b0b7ac7c9d01e186ad1574b44ca37b43453f27c2 100644 (file)
@@ -92,6 +92,10 @@ int main(int argc, char *argv[])
                exit(err);
        }
 
+       /* no need of other inherited fds but stderr */
+       close(fileno(stdin));
+       close(fileno(stdout));
+
        err = 0;
        for (;;) {
                int status;
index 3b5023c9f616dd0cca9eb3f1beaee93592242517..7d5763a7593ef82eaaf799faeea7ea36f2cf3f04 100644 (file)
@@ -547,6 +547,10 @@ int lxc_start(const char *name, char *const argv[], struct lxc_conf *conf)
                goto out_fini;
        }
 
+       /* no need of other inherited fds but stderr */
+       close(fileno(stdin));
+       close(fileno(stdout));
+
        err = lxc_poll(name, handler);
        if (err) {
                ERROR("mainloop exited with an error");