diff options
author | Phil Sutter <phil@nwl.cc> | 2017-08-17 19:09:32 +0200 |
---|---|---|
committer | Stephen Hemminger <stephen@networkplumber.org> | 2017-08-18 09:13:17 -0700 |
commit | 436270a45dea2fe5dbc4680f9c8e31f07d167f20 (patch) | |
tree | dff9837bf22f0aa0e355af019b284e197fcf31e0 /tipc | |
parent | 1e3197e0fdbf299fe24cdba7c0d613317ed82063 (diff) |
tipc/node: Fix socket fd check in cmd_node_get_addr()
socket() returns -1 on error, not 0.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'tipc')
-rw-r--r-- | tipc/node.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tipc/node.c b/tipc/node.c index 201fe1a4..fe085aec 100644 --- a/tipc/node.c +++ b/tipc/node.c @@ -109,7 +109,8 @@ static int cmd_node_get_addr(struct nlmsghdr *nlh, const struct cmd *cmd, socklen_t sz = sizeof(struct sockaddr_tipc); struct sockaddr_tipc addr; - if (!(sk = socket(AF_TIPC, SOCK_RDM, 0))) { + sk = socket(AF_TIPC, SOCK_RDM, 0); + if (sk < 0) { fprintf(stderr, "opening TIPC socket: %s\n", strerror(errno)); return -1; } |