mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
ctdb-tests: Check result of write() in ARP and TCP tests
CTDB -O3 --picky-developer build is failing. Not sure how this slipped through. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Thu Sep 6 08:33:59 CEST 2018 on sn-devel-144
This commit is contained in:
parent
05862b7bb0
commit
bc62182ff4
@ -59,6 +59,7 @@ static void test_arp(const char *addr_str, const char *hwaddr_str, bool reply)
|
||||
uint8_t buf[512];
|
||||
size_t buflen = sizeof(buf);
|
||||
size_t len;
|
||||
ssize_t num_written;
|
||||
int ret;
|
||||
|
||||
ret = ctdb_sock_addr_from_string(addr_str, &addr, false);
|
||||
@ -80,7 +81,8 @@ static void test_arp(const char *addr_str, const char *hwaddr_str, bool reply)
|
||||
|
||||
assert(ret == 0);
|
||||
|
||||
write(STDOUT_FILENO, buf, len);
|
||||
num_written = write(STDOUT_FILENO, buf, len);
|
||||
assert(num_written == len);
|
||||
}
|
||||
|
||||
#else /* HAVE_PACKETSOCKET */
|
||||
@ -104,6 +106,7 @@ static void test_tcp(const char *src_str,
|
||||
uint8_t buf[512];
|
||||
struct ether_header *eth;
|
||||
size_t expected_len, len;
|
||||
ssize_t num_written;
|
||||
char src_str_out[64], dst_str_out[64];
|
||||
uint32_t seq_out, ack_out;
|
||||
int rst_out;
|
||||
@ -156,7 +159,10 @@ static void test_tcp(const char *src_str,
|
||||
assert(ret == 0);
|
||||
assert(len == expected_len);
|
||||
|
||||
write(STDOUT_FILENO, buf + sizeof(struct ether_header), len);
|
||||
num_written = write(STDOUT_FILENO,
|
||||
buf + sizeof(struct ether_header),
|
||||
len);
|
||||
assert(num_written == len);
|
||||
|
||||
switch (ntohs(eth->ether_type)) {
|
||||
case ETHERTYPE_IP:
|
||||
|
Loading…
Reference in New Issue
Block a user