In both of these cases if there is actually an error, we won't close the
pipe and the api call will hang. Instead, let's be sure to close the pipe
before waiting, so that it doesn't hang.
Signed-off-by: Tycho Andersen <tycho@tycho.ws>
}
on_error:
- /* Wait for child to finish. */
- if (pid > 0)
- status = wait_for_pid(pid);
-
if (p[0] != -1)
close(p[0]);
close(p[1]);
+ /* Wait for child to finish. */
+ if (pid > 0)
+ status = wait_for_pid(pid);
+
if (status < 0)
ret = -1;
}
on_error:
+ if (p[0] != -1)
+ close(p[0]);
+ close(p[1]);
+
/* Wait for child to finish. */
if (pid > 0)
ret = wait_for_pid(pid);
if (host_gid_map && (host_gid_map != container_root_gid))
free(host_gid_map);
- if (p[0] != -1)
- close(p[0]);
- close(p[1]);
-
return ret;
}