[CRIU] [PATCH 5/5] sk-inet: fix error handling

Andrey Vagin avagin at openvz.org
Wed Mar 27 09:23:17 EDT 2013


Use a separate variable for the function exit code. By default it is -1
and it is set to zero at the end. It's not changed anywere anywhere
except these two places.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 sk-inet.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sk-inet.c b/sk-inet.c
index 0e6bf43..62adbc5 100644
--- a/sk-inet.c
+++ b/sk-inet.c
@@ -232,7 +232,7 @@ static int do_dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p, int fa
 	struct inet_sk_desc *sk;
 	InetSkEntry ie = INET_SK_ENTRY__INIT;
 	SkOptsEntry skopts = SK_OPTS_ENTRY__INIT;
-	int ret = -1;
+	int ret = -1, err = -1;
 
 	sk = (struct inet_sk_desc *)lookup_socket(p->stat.st_ino, family);
 	if (!sk) {
@@ -314,17 +314,17 @@ static int do_dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p, int fa
 
 	switch (sk->proto) {
 	case IPPROTO_TCP:
-		ret = dump_one_tcp(lfd, sk);
+		err = dump_one_tcp(lfd, sk);
 		break;
 	default:
-		ret = 0;
+		err = 0;
 		break;
 	}
 err:
 	release_skopts(&skopts);
 	xfree(ie.src_addr);
 	xfree(ie.dst_addr);
-	return ret;
+	return err;
 }
 
 static int dump_one_inet_fd(int lfd, u32 id, const struct fd_parms *p)
-- 
1.7.11.7



More information about the CRIU mailing list