[CRIU] [PATCH 03/18] netlink: don't call close a negative value

Andrei Vagin avagin at openvz.org
Thu Nov 9 22:20:57 MSK 2017


From: Andrei Vagin <avagin at virtuozzo.com>

CID 73378 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
6. negative_returns: sk is passed to a parameter that cannot be negative.

Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
 criu/sk-netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/criu/sk-netlink.c b/criu/sk-netlink.c
index 2761305d1..b522963e8 100644
--- a/criu/sk-netlink.c
+++ b/criu/sk-netlink.c
@@ -245,7 +245,7 @@ static int open_netlink_sk(struct file_desc *d, int *new_fd)
 	*new_fd = sk;
 	return 0;
 err:
-	close(sk);
+	close_safe(&sk);
 	return -1;
 }
 
-- 
2.13.6



More information about the CRIU mailing list