mirror of
https://github.com/samba-team/samba.git
synced 2025-02-26 21:57:41 +03:00
ctdb-common: Fix CID 1362729 Unchecked return value from library
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> (cherry picked from commit 6d1099a522de129cee8cdf9183ab3aaabe0592db)
This commit is contained in:
parent
f2c64a965a
commit
14c7c6a0bf
@ -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;
|
||||
|
@ -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));
|
||||
|
@ -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)) {
|
||||
|
@ -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)) {
|
||||
|
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user