]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
utils: only move_fd() when fdopen() has been successful 3275/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 5 Mar 2020 10:14:24 +0000 (11:14 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 5 Mar 2020 10:14:24 +0000 (11:14 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/utils.c

index 406a54c0aa13e342ca3ccc80f55f9bf3a1dda4a4..8397d54aef97077638df9492ac0d0ff4b2ace4f2 100644 (file)
@@ -1724,9 +1724,10 @@ static int process_dead(/* takes */ int status_fd)
                return -1;
 
        /* transfer ownership of fd */
-       f = fdopen(move_fd(dupfd), "re");
+       f = fdopen(dupfd, "re");
        if (!f)
                return -1;
+       move_fd(dupfd);
 
        ret = 0;
        while (getline(&line, &n, f) != -1) {