From: Martin Schwenke Date: Wed, 5 Sep 2018 02:42:07 +0000 (+1000) Subject: ctdb-tests: Check result of write() in ARP and TCP tests X-Git-Tag: tdb-1.3.17~1737 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc62182ff46023494f710a78d5a57a7baffa8780;p=thirdparty%2Fsamba.git 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 Reviewed-by: Amitay Isaacs Autobuild-User(master): Amitay Isaacs Autobuild-Date(master): Thu Sep 6 08:33:59 CEST 2018 on sn-devel-144 --- diff --git a/ctdb/tests/src/system_socket_test.c b/ctdb/tests/src/system_socket_test.c index 6dd9e432ef7..f7d0c7c7701 100644 --- a/ctdb/tests/src/system_socket_test.c +++ b/ctdb/tests/src/system_socket_test.c @@ -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: