socket() returns -1 on error, not 0. Signed-off-by: Phil Sutter <p...@nwl.cc> --- tipc/node.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tipc/node.c b/tipc/node.c index 201fe1a4df3bd..fe085aec9b4ac 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; } -- 2.13.1