[CRIU] [PATCH 4/5] zdtm unix_sock: don't use errno

Kir Kolyshkin kir at openvz.org
Wed Oct 21 16:06:15 PDT 2015


In this place, errno is not being set and can be 0 or some random value,
so we should not use it. In case errno happens to be 0, we end up returning
a success status from a function while we should have returned a failure.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 test/zdtm/live/streaming/unix_sock.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/test/zdtm/live/streaming/unix_sock.c b/test/zdtm/live/streaming/unix_sock.c
index 3d1c8c4..f8b00fc 100644
--- a/test/zdtm/live/streaming/unix_sock.c
+++ b/test/zdtm/live/streaming/unix_sock.c
@@ -110,9 +110,8 @@ static int setup_clnt_sock(void)
 	int ret = 0;
 
 	if (fill_sock_name(&name, filename) < 0) {
-		ret = -errno;
 		pr_perror("filename \"%s\" is too long", filename);
-		return ret;
+		return -1;
 	}
 
 	sock = socket(PF_LOCAL, SOCK_STREAM, 0);
-- 
2.4.3



More information about the CRIU mailing list