From: Vincent Giersch Date: Wed, 11 Jun 2014 14:23:27 +0000 (+0200) Subject: Fix a file descriptor leak in the monitord spawn X-Git-Tag: lxc-1.0.6~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7802d4828f8432a6153d1eefff886d03b2f56060;p=thirdparty%2Flxc.git Fix a file descriptor leak in the monitord spawn Signed-off-by: Vincent Giersch Acked-by: Stéphane Graber --- diff --git a/src/lxc/monitor.c b/src/lxc/monitor.c index f356adf21..7c6dbb4a5 100644 --- a/src/lxc/monitor.c +++ b/src/lxc/monitor.c @@ -319,6 +319,7 @@ int lxc_monitord_spawn(const char *lxcpath) SYSERROR("failed to setsid"); exit(EXIT_FAILURE); } + lxc_check_inherited(NULL, pipefd[1]); close(0); close(1); close(2); diff --git a/src/lxc/start.c b/src/lxc/start.c index e6b4895cd..26763346c 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -203,7 +203,7 @@ restart: if (match_fd(fd)) continue; - if (conf->close_all_fds) { + if (conf == NULL || conf->close_all_fds) { close(fd); closedir(dir); INFO("closed inherited fd %d", fd);