From: Christian Brauner Date: Thu, 5 Mar 2020 10:14:24 +0000 (+0100) Subject: utils: only move_fd() when fdopen() has been successful X-Git-Tag: lxc-4.0.0~46^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92bdc5937e30f3cbee2e7076fb6364a3ff554b41;p=thirdparty%2Flxc.git utils: only move_fd() when fdopen() has been successful Signed-off-by: Christian Brauner --- diff --git a/src/lxc/utils.c b/src/lxc/utils.c index 406a54c0a..8397d54ae 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -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) {