From affaa6da9dd10a99b9f60e24ceb3a216d56fcba1 Mon Sep 17 00:00:00 2001 From: Michel Normand Date: Thu, 29 Apr 2010 10:03:58 +0200 Subject: [PATCH] close fd 0 and 1 where not required 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 Signed-off-by: Daniel Lezcano --- src/lxc/lxc_init.c | 4 ++++ src/lxc/start.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/lxc/lxc_init.c b/src/lxc/lxc_init.c index 05b429735..b0b7ac7c9 100644 --- a/src/lxc/lxc_init.c +++ b/src/lxc/lxc_init.c @@ -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; diff --git a/src/lxc/start.c b/src/lxc/start.c index 3b5023c9f..7d5763a75 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -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"); -- 2.47.2