Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
ctdb-tcp: Fix CID 1362724 Unchecked return value from library
Browse files Browse the repository at this point in the history
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12157

Signed-off-by: Martin Schwenke <[email protected]>
Reviewed-by: Amitay Isaacs <[email protected]>
  • Loading branch information
martin-schwenke authored and Martin Schwenke committed Aug 17, 2016
1 parent 1710b14 commit bacf57c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ctdb/tcp/tcp_connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ static void ctdb_listen_event(struct tevent_context *ev, struct tevent_fd *fde,
int fd, nodeid;
struct ctdb_incoming *in;
int one = 1;
int ret;

memset(&addr, 0, sizeof(addr));
len = sizeof(addr);
Expand All @@ -261,7 +262,17 @@ static void ctdb_listen_event(struct tevent_context *ev, struct tevent_fd *fde,
in->fd = fd;
in->ctdb = ctdb;

set_blocking(in->fd, false);
ret = set_blocking(in->fd, false);
if (ret != 0) {
DEBUG(DEBUG_ERR,
(__location__
" failed to set socket non-blocking (%s)\n",
strerror(errno)));
close(in->fd);
in->fd = -1;
return;
}

set_close_on_exec(in->fd);

DEBUG(DEBUG_DEBUG, (__location__ " Created SOCKET FD:%d to incoming ctdb connection\n", fd));
Expand Down

0 comments on commit bacf57c

Please sign in to comment.