naccyde / rpms / iproute

Forked from rpms/iproute 9 months ago
Clone

Blame SOURCES/0074-tipc-node-Fix-socket-fd-check-in-cmd_node_get_addr.patch

36cfb7
From 8743a7a8978270195693441f370cea552f100cae Mon Sep 17 00:00:00 2001
36cfb7
From: Andrea Claudi <aclaudi@redhat.com>
36cfb7
Date: Mon, 29 Apr 2019 20:05:38 +0200
36cfb7
Subject: [PATCH] tipc/node: Fix socket fd check in cmd_node_get_addr()
36cfb7
36cfb7
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1465646
36cfb7
Upstream Status: iproute2.git commit 436270a45dea2
36cfb7
36cfb7
commit 436270a45dea2fe5dbc4680f9c8e31f07d167f20
36cfb7
Author: Phil Sutter <phil@nwl.cc>
36cfb7
Date:   Thu Aug 17 19:09:32 2017 +0200
36cfb7
36cfb7
    tipc/node: Fix socket fd check in cmd_node_get_addr()
36cfb7
36cfb7
    socket() returns -1 on error, not 0.
36cfb7
36cfb7
    Signed-off-by: Phil Sutter <phil@nwl.cc>
36cfb7
---
36cfb7
 tipc/node.c | 3 ++-
36cfb7
 1 file changed, 2 insertions(+), 1 deletion(-)
36cfb7
36cfb7
diff --git a/tipc/node.c b/tipc/node.c
36cfb7
index 201fe1a4df3bd..fe085aec9b4ac 100644
36cfb7
--- a/tipc/node.c
36cfb7
+++ b/tipc/node.c
36cfb7
@@ -109,7 +109,8 @@ static int cmd_node_get_addr(struct nlmsghdr *nlh, const struct cmd *cmd,
36cfb7
 	socklen_t sz = sizeof(struct sockaddr_tipc);
36cfb7
 	struct sockaddr_tipc addr;
36cfb7
 
36cfb7
-	if (!(sk = socket(AF_TIPC, SOCK_RDM, 0))) {
36cfb7
+	sk = socket(AF_TIPC, SOCK_RDM, 0);
36cfb7
+	if (sk < 0) {
36cfb7
 		fprintf(stderr, "opening TIPC socket: %s\n", strerror(errno));
36cfb7
 		return -1;
36cfb7
 	}
36cfb7
-- 
e138d9
2.21.0
36cfb7