[CRIU] [PATCH 06/15] img: Don't return fd, return -1 instead

Pavel Emelyanov xemul at parallels.com
Mon Sep 29 01:48:10 PDT 2014


The same -- int-fd will soon go away, so return the
explicit int -1 instead of it.

Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 cgroup.c     | 2 +-
 cr-restore.c | 6 +++---
 pstree.c     | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cgroup.c b/cgroup.c
index 38db4bb..a4967ef 100644
--- a/cgroup.c
+++ b/cgroup.c
@@ -1308,7 +1308,7 @@ int prepare_cgroup(void)
 		if (errno == ENOENT) /* backward compatibility */
 			return 0;
 		else
-			return fd;
+			return -1;
 	}
 
 	ret = pb_read_one_eof(fd, &ce, PB_CGROUP);
diff --git a/cr-restore.c b/cr-restore.c
index ae083e8..0999116 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1984,7 +1984,7 @@ static int prepare_itimers_from_fd(int pid, struct task_restore_args *args)
 
 	fd = open_image(CR_FD_ITIMERS, O_RSTR, pid);
 	if (fd < 0)
-		return fd;
+		return -1;
 
 	ret = pb_read_one(fd, &ie, PB_ITIMER);
 	if (ret < 0)
@@ -2109,7 +2109,7 @@ static int prepare_posix_timers_from_fd(int pid)
 		if (errno == ENOENT) /* backward compatibility */
 			return 0;
 		else
-			return fd;
+			return -1;
 	}
 
 	while (1) {
@@ -2178,7 +2178,7 @@ static int prepare_creds(int pid, struct task_restore_args *args)
 
 	fd = open_image(CR_FD_CREDS, O_RSTR, pid);
 	if (fd < 0)
-		return fd;
+		return -1;
 
 	ret = pb_read_one(fd, &ce, PB_CREDS);
 	close_safe(&fd);
diff --git a/pstree.c b/pstree.c
index cef79b8..26c9568 100644
--- a/pstree.c
+++ b/pstree.c
@@ -325,7 +325,7 @@ static int read_pstree_image(void)
 
 	ps_fd = open_image(CR_FD_PSTREE, O_RSTR);
 	if (ps_fd < 0)
-		return ps_fd;
+		return -1;
 
 	while (1) {
 		PstreeEntry *e;
-- 
1.8.4.2




More information about the CRIU mailing list