]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf: always close pipe in run_userns_fn()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 29 Jul 2018 21:03:32 +0000 (23:03 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 29 Jul 2018 22:16:14 +0000 (00:16 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index e55c40bf2f6f677531af8005979b732d7888df89..f4a95be7987dbc2e2a3da6192bdd3dcf8cd95fa0 100644 (file)
@@ -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);