From: Christian Brauner Date: Sun, 29 Jul 2018 21:03:32 +0000 (+0200) Subject: conf: always close pipe in run_userns_fn() X-Git-Tag: lxc-3.1.0~185^2~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=adaffdd7a664acfda1cebf5485fae86a941a51f4;p=thirdparty%2Flxc.git conf: always close pipe in run_userns_fn() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index e55c40bf2..f4a95be79 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -4121,6 +4121,7 @@ struct userns_fn_data { static int run_userns_fn(void *data) { + int ret; char c; struct userns_fn_data *d = data; @@ -4130,14 +4131,14 @@ static int run_userns_fn(void *data) /* Wait for parent to finish establishing a new mapping in the user * namespace we are executing in. */ - if (lxc_read_nointr(d->p[0], &c, 1) != 1) - return -1; - + ret = lxc_read_nointr(d->p[0], &c, 1); /* Close read end of the pipe. */ close(d->p[0]); + if (ret != 1) + return -1; if (d->fn_name) - TRACE("calling function \"%s\"", d->fn_name); + TRACE("Calling function \"%s\"", d->fn_name); /* Call function to run. */ return d->fn(d->arg);