From: Joseph Sutton Date: Fri, 6 Oct 2023 00:49:43 +0000 (+1300) Subject: lib:replace: Properly check result of write() and read() (CID 1034925) X-Git-Tag: tevent-0.16.0~76 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f4aa3508c0423a98dd2e75edb2f0afa1921fb28;p=thirdparty%2Fsamba.git lib:replace: Properly check result of write() and read() (CID 1034925) Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- diff --git a/lib/replace/tests/testsuite.c b/lib/replace/tests/testsuite.c index c0dcda55bd2..58624f11eb6 100644 --- a/lib/replace/tests/testsuite.c +++ b/lib/replace/tests/testsuite.c @@ -854,14 +854,14 @@ static int test_socketpair(void) return false; } - if (write(sock[1], "automatisch", 12) == -1) { + if (write(sock[1], "automatisch", 12) != 12) { printf("failure: socketpair [\n" "write() failed: %s\n" "]\n", strerror(errno)); return false; } - if (read(sock[0], buf, 12) == -1) { + if (read(sock[0], buf, 12) != 12) { printf("failure: socketpair [\n" "read() failed: %s\n" "]\n", strerror(errno));