Commit f2a46c3d authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

util: check that stdin are unused before closing

Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent e7189054
......@@ -532,13 +532,13 @@ int cr_system(int in, int out, int err, char *cmd, char *const argv[])
if (out == in)
out = DUP_SAFE(out, out_chld);
if (move_img_fd(&out, STDIN_FILENO) ||
move_img_fd(&err, STDIN_FILENO))
goto out_chld;
if (in < 0) {
close(STDIN_FILENO);
} else {
if (move_img_fd(&out, STDIN_FILENO) ||
move_img_fd(&err, STDIN_FILENO))
goto out_chld;
if (reopen_fd_as_nocheck(STDIN_FILENO, in))
goto out_chld;
}
......
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