ctdb-daemon: Fix CID 1362723 Unchecked return value from library
authorMartin Schwenke <martin@meltin.net>
Wed, 10 Aug 2016 07:35:22 +0000 (17:35 +1000)
committerMartin Schwenke <martins@samba.org>
Wed, 17 Aug 2016 21:00:25 +0000 (23:00 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12157

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_daemon.c

index 6c8129c856d7c1749eb2a252c60e5fbf9bfefb6f..47e49dfa3cd2516a1087700e04408c12a8a7400e 100644 (file)
@@ -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));