2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

restore: Make reopen_fd_as to print error

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Cyrill Gorcunov
2011-09-27 18:39:56 +04:00
parent 401464d22a
commit e672d1a87f

8
util.c
View File

@@ -244,9 +244,13 @@ int reopen_fd_as(int new_fd, int old_fd)
{
if (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;
close(old_fd);
}
/* Just to have error message if failed */
close_safe(&old_fd);
}
return new_fd;