[CRIU] [PATCH 3/3] restore: handle of errors from setting fd flags

Andrey Vagin avagin at openvz.org
Mon Mar 18 13:40:09 EDT 2013


Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 files.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/files.c b/files.c
index 4b5f721..5be2c85 100644
--- a/files.c
+++ b/files.c
@@ -580,7 +580,11 @@ static int send_fd_to_self(int fd, struct fdinfo_list_entry *fle, int *sock)
 		return -1;
 	}
 
-	fcntl(dfd, F_SETFD, fle->fe->flags);
+	if (fcntl(dfd, F_SETFD, fle->fe->flags) == -1) {
+		pr_perror("Unable to set file descriptor flags");
+		return -1;
+	}
+
 	return 0;
 }
 
@@ -645,7 +649,10 @@ static int open_fd(int pid, struct fdinfo_list_entry *fle)
 	if (reopen_fd_as(fle->fe->fd, new_fd))
 		return -1;
 
-	fcntl(fle->fe->fd, F_SETFD, fle->fe->flags);
+	if (fcntl(fle->fe->fd, F_SETFD, fle->fe->flags) == -1) {
+		pr_perror("Unable to set file descriptor flags");
+		return -1;
+	}
 
 	return serve_out_fd(pid, fle->fe->fd, d);
 }
@@ -671,7 +678,11 @@ static int receive_fd(int pid, struct fdinfo_list_entry *fle)
 	if (reopen_fd_as(fle->fe->fd, tmp) < 0)
 		return -1;
 
-	fcntl(fle->fe->fd, F_SETFD, fle->fe->flags);
+	if (fcntl(fle->fe->fd, F_SETFD, fle->fe->flags) == -1) {
+		pr_perror("Unable to set file descriptor flags");
+		return -1;
+	}
+
 	return 0;
 }
 
-- 
1.7.11.7



More information about the CRIU mailing list