[CRIU] [PATCH 17/21] pipes: Don't call for restore_fown if open
failed
Cyrill Gorcunov
gorcunov at openvz.org
Wed Jun 6 18:21:57 EDT 2012
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
pipes.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/pipes.c b/pipes.c
index 1359d7f..c3aa240 100644
--- a/pipes.c
+++ b/pipes.c
@@ -181,8 +181,12 @@ static int recv_pipe_fd(struct pipe_info *pi)
fd = open(path, pi->pe.flags);
close(tmp);
- if (restore_fown(fd, &pi->pe.fown))
- return -1;
+ if (fd >= 0) {
+ if (restore_fown(fd, &pi->pe.fown)) {
+ close(fd);
+ return -1;
+ }
+ }
return fd;
}
--
1.7.7.6
More information about the CRIU
mailing list