ctdb-common: Fix CID 1362729 Unchecked return value from library
authorMartin Schwenke <martin@meltin.net>
Thu, 11 Aug 2016 01:15:58 +0000 (11:15 +1000)
committerMartin Schwenke <martins@samba.org>
Wed, 17 Aug 2016 21:00:25 +0000 (23:00 +0200)
Drop setting socket non-blocking and close-on-exec.  The socket is
closed soon after.  Only a single packet is sent, making it almost
impossible for it to block.  Also, note that sockets aren't setup this
way for IPv6.

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/common/system_aix.c
ctdb/common/system_freebsd.c
ctdb/common/system_gnu.c
ctdb/common/system_kfreebsd.c
ctdb/common/system_linux.c

index 48cd7817c919bfcb55bd0675f395cbeec604373d..10798a7d42f8f1b08cfdca3edc1c40245373011d 100644 (file)
@@ -143,9 +143,6 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
                return -1;
        }
 
-       set_blocking(s, false);
-       set_close_on_exec(s);
-
        memset(&ip4pkt, 0, sizeof(ip4pkt));
        ip4pkt.ip.ip_v     = 4;
        ip4pkt.ip.ip_hl    = sizeof(ip4pkt.ip)/4;
index a03b97ad2f3002dc06e518fbafeae2f59dd1e793..ca1300a74ce63edbe8aabbbdf0590ef6073871c3 100644 (file)
@@ -180,9 +180,6 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
                        return -1;
                }
 
-               set_blocking(s, false);
-               set_close_on_exec(s);
-
                ret = sendto(s, &ip4pkt, sizeof(ip4pkt), 0,
                             (const struct sockaddr *)&dest->ip,
                             sizeof(dest->ip));
index 09c4ffef8e9558c20e547ffb242762850ad80cb4..0eed47e4e05e9d03560d454eb677dbdeb9202a4b 100644 (file)
@@ -178,9 +178,6 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
                        return -1;
                }
 
-               set_blocking(s, false);
-               set_close_on_exec(s);
-
                ret = sendto(s, &ip4pkt, sizeof(ip4pkt), 0, &dest->ip, sizeof(dest->ip));
                close(s);
                if (ret != sizeof(ip4pkt)) {
index 56f7c1c75f06e35de1b5258eb9d7bfc18a9f14a8..87624d69bbaa5718d9e1186e0f50224bae27048f 100644 (file)
@@ -178,9 +178,6 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
                        return -1;
                }
 
-               set_blocking(s, false);
-               set_close_on_exec(s);
-
                ret = sendto(s, &ip4pkt, sizeof(ip4pkt), 0, &dest->ip, sizeof(dest->ip));
                close(s);
                if (ret != sizeof(ip4pkt)) {
index b66ce670288d6e1dc2e879dba22e11697249fa15..bf022e3ada07d9f22b399ea2906dc7e6e12ec01c 100644 (file)
@@ -386,9 +386,6 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest,
                        return -1;
                }
 
-               set_blocking(s, false);
-               set_close_on_exec(s);
-
                ret = sendto(s, &ip4pkt, sizeof(ip4pkt), 0,
                             (const struct sockaddr *)&dest->ip,
                             sizeof(dest->ip));