utils: only move_fd() when fdopen() has been successful

parent c60ee0a9
...@@ -1724,9 +1724,10 @@ static int process_dead(/* takes */ int status_fd) ...@@ -1724,9 +1724,10 @@ static int process_dead(/* takes */ int status_fd)
return -1; return -1;
/* transfer ownership of fd */ /* transfer ownership of fd */
f = fdopen(move_fd(dupfd), "re"); f = fdopen(dupfd, "re");
if (!f) if (!f)
return -1; return -1;
move_fd(dupfd);
ret = 0; ret = 0;
while (getline(&line, &n, f) != -1) { while (getline(&line, &n, f) != -1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment