From 965920b19b5133a48e745afb104cf40d0bd166e3 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Wed, 10 Aug 2016 17:35:22 +1000 Subject: [PATCH] ctdb-daemon: Fix CID 1362723 Unchecked return value from library BUG: https://bugzilla.samba.org/show_bug.cgi?id=12157 Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs (cherry picked from commit 1de8948cb5f4d904dd0d5520c3f13034ed522cb2) --- ctdb/server/ctdb_daemon.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c index 6c8129c856d..47e49dfa3cd 100644 --- a/ctdb/server/ctdb_daemon.c +++ b/ctdb/server/ctdb_daemon.c @@ -930,6 +930,7 @@ static void ctdb_accept_client(struct tevent_context *ev, struct ctdb_client *client; struct ctdb_client_pid_list *client_pid; pid_t peer_pid = 0; + int ret; memset(&addr, 0, sizeof(addr)); len = sizeof(addr); @@ -938,7 +939,16 @@ static void ctdb_accept_client(struct tevent_context *ev, return; } - set_blocking(fd, false); + ret = set_blocking(fd, false); + if (ret != 0) { + DEBUG(DEBUG_ERR, + (__location__ + " failed to set socket non-blocking (%s)\n", + strerror(errno))); + close(fd); + return; + } + set_close_on_exec(fd); DEBUG(DEBUG_DEBUG,(__location__ " Created SOCKET FD:%d to connected child\n", fd)); -- 2.34.1