Commit affaa6da by Michel Normand Committed by Daniel Lezcano

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: 's avatarMichel Normand <normand@fr.ibm.com> Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 698287d8
...@@ -92,6 +92,10 @@ int main(int argc, char *argv[]) ...@@ -92,6 +92,10 @@ int main(int argc, char *argv[])
exit(err); exit(err);
} }
/* no need of other inherited fds but stderr */
close(fileno(stdin));
close(fileno(stdout));
err = 0; err = 0;
for (;;) { for (;;) {
int status; int status;
......
...@@ -547,6 +547,10 @@ int lxc_start(const char *name, char *const argv[], struct lxc_conf *conf) ...@@ -547,6 +547,10 @@ int lxc_start(const char *name, char *const argv[], struct lxc_conf *conf)
goto out_fini; goto out_fini;
} }
/* no need of other inherited fds but stderr */
close(fileno(stdin));
close(fileno(stdout));
err = lxc_poll(name, handler); err = lxc_poll(name, handler);
if (err) { if (err) {
ERROR("mainloop exited with an error"); ERROR("mainloop exited with an error");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment