1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

ctdb-common: Fix CID 1362728 Unchecked return value from library

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>
(cherry picked from commit 4bc934f13234ece7fae0d533c23fd879e55b8ad2)
This commit is contained in:
Martin Schwenke 2016-08-10 17:04:45 +10:00 committed by Stefan Metzmacher
parent 14c7c6a0bf
commit 2f10d65e2c

View File

@ -455,7 +455,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
*/
int ctdb_sys_open_capture_socket(const char *iface, void **private_data)
{
int s;
int s, ret;
/* Open a socket to capture all traffic */
s = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
@ -466,7 +466,16 @@ int ctdb_sys_open_capture_socket(const char *iface, void **private_data)
DEBUG(DEBUG_DEBUG, (__location__ " Created RAW SOCKET FD:%d for tcp tickle\n", s));
set_blocking(s, false);
ret = set_blocking(s, false);
if (ret != 0) {
DEBUG(DEBUG_ERR,
(__location__
" failed to set socket non-blocking (%s)\n",
strerror(errno)));
close(s);
return -1;
}
set_close_on_exec(s);
return s;