mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 06:45:35 +00:00
util: check that stdin are unused before closing
Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
e7189054d5
commit
f2a46c3d00
8
util.c
8
util.c
@@ -532,13 +532,13 @@ int cr_system(int in, int out, int err, char *cmd, char *const argv[])
|
|||||||
if (out == in)
|
if (out == in)
|
||||||
out = DUP_SAFE(out, out_chld);
|
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) {
|
if (in < 0) {
|
||||||
close(STDIN_FILENO);
|
close(STDIN_FILENO);
|
||||||
} else {
|
} 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))
|
if (reopen_fd_as_nocheck(STDIN_FILENO, in))
|
||||||
goto out_chld;
|
goto out_chld;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user