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.1.0.alpha2~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3603af1bc727097da7a309ba29431fc88d631c02;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 bb136af0d..60f07772f 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);