[lxc-devel] [lxc/master] utils: only move_fd() when fdopen() has been successful
brauner on Github
lxc-bot at linuxcontainers.org
Thu Mar 5 10:15:07 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200305/6d5dbae4/attachment.bin>
-------------- next part --------------
From 92bdc5937e30f3cbee2e7076fb6364a3ff554b41 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 5 Mar 2020 11:14:24 +0100
Subject: [PATCH] utils: only move_fd() when fdopen() has been successful
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/utils.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/lxc/utils.c b/src/lxc/utils.c
index 406a54c0aa..8397d54aef 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) {
More information about the lxc-devel
mailing list