From: Dmitry V. Levin Date: Wed, 18 May 2016 09:14:12 +0000 (+0000) Subject: tests/read-write.c: robustify against os specific issues X-Git-Tag: v4.12~116 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a8e820586ece77fe5430ca089b255f735a92cb6b;p=strace tests/read-write.c: robustify against os specific issues Do not assume that write syscall fails when only part of the specified memory buffer is accessible. With some kernels, one accessible byte at the end of page is enough for write syscall to return 1. * tests/read-write.c (main): Tweak the test that can lead to a partial write. --- diff --git a/tests/read-write.c b/tests/read-write.c index 4efe1473..4d1e7302 100644 --- a/tests/read-write.c +++ b/tests/read-write.c @@ -152,12 +152,11 @@ main(void) perror_msg_and_fail("write: expected 0, returned %ld", rc); tprintf("write(1, \"\", 0) = 0\n"); - rc = write(1, w, w_len + 1); + rc = write(1, efault, 1); if (rc != -1) perror_msg_and_fail("write: expected -1 EFAULT" ", returned %ld", rc); - tprintf("write(1, %p, %u) = -1 EFAULT (%m)\n", - w, w_len + 1); + tprintf("write(1, %p, 1) = -1 EFAULT (%m)\n", efault); rc = write(1, w, w_len); if (rc != (int) w_len)