Skip to content

Commit

Permalink
ctdb-daemon: Fix CID 1362726 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 0e73734 commit 0de5242
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ctdb/server/ctdb_daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,7 @@ static void ctdb_accept_client(struct tevent_context *ev,
static int ux_socket_bind(struct ctdb_context *ctdb)
{
struct sockaddr_un addr;
int ret;

ctdb->daemon.sd = socket(AF_UNIX, SOCK_STREAM, 0);
if (ctdb->daemon.sd == -1) {
Expand All @@ -1007,7 +1008,15 @@ static int ux_socket_bind(struct ctdb_context *ctdb)
unlink(ctdb->daemon.name);

set_close_on_exec(ctdb->daemon.sd);
set_blocking(ctdb->daemon.sd, false);

ret = set_blocking(ctdb->daemon.sd, false);
if (ret != 0) {
DEBUG(DEBUG_ERR,
(__location__
" failed to set socket non-blocking (%s)\n",
strerror(errno)));
goto failed;
}

if (bind(ctdb->daemon.sd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
DEBUG(DEBUG_CRIT,("Unable to bind on ctdb socket '%s'\n", ctdb->daemon.name));
Expand Down

0 comments on commit 0de5242

Please sign in to comment.