mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
restore: Make reopen_fd_as to print error
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
401464d22a
commit
e672d1a87f
1 changed files with 6 additions and 2 deletions
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) {
|
||||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue