mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-04 16:25:31 +00:00
restore: Make reopen_fd_as to print error
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
8
util.c
8
util.c
@@ -244,9 +244,13 @@ int reopen_fd_as(int new_fd, int old_fd)
|
|||||||
{
|
{
|
||||||
if (old_fd != new_fd) {
|
if (old_fd != new_fd) {
|
||||||
int tmp = dup2(old_fd, new_fd);
|
int tmp = dup2(old_fd, new_fd);
|
||||||
if (tmp < 0)
|
if (tmp < 0) {
|
||||||
|
pr_perror("Dup on %d -> %d failed\n", old_fd, new_fd);
|
||||||
return tmp;
|
return tmp;
|
||||||
close(old_fd);
|
}
|
||||||
|
|
||||||
|
/* Just to have error message if failed */
|
||||||
|
close_safe(&old_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new_fd;
|
return new_fd;
|
||||||
|
Reference in New Issue
Block a user