From: Dmitry V. Levin Date: Wed, 18 May 2016 09:21:54 +0000 (+0000) Subject: tests/pread64-pwrite64.c: robustify against os specific issues X-Git-Tag: v4.12~115 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff2b853e7fce27621ef01aacfbccab62f489bf16;p=strace tests/pread64-pwrite64.c: robustify against os specific issues Do not assume that pwrite64 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 pwrite64 syscall to return 1. * tests/pread64-pwrite64.c (main): Tweak the test that can lead to a partial write. --- diff --git a/tests/pread64-pwrite64.c b/tests/pread64-pwrite64.c index b1d45de3..4a0932a9 100644 --- a/tests/pread64-pwrite64.c +++ b/tests/pread64-pwrite64.c @@ -156,12 +156,11 @@ main(void) perror_msg_and_fail("pwrite64: expected 0, returned %ld", rc); tprintf("pwrite64(1, \"\", 0, 0) = 0\n"); - rc = pwrite(1, w, w_len + 1, 0); + rc = pwrite(1, efault, 1, 0); if (rc != -1) perror_msg_and_fail("pwrite64: expected -1 EFAULT" ", returned %ld", rc); - tprintf("pwrite64(1, %p, %u, 0) = -1 EFAULT (%m)\n", - w, w_len + 1); + tprintf("pwrite64(1, %p, 1, 0) = -1 EFAULT (%m)\n", efault); rc = pwrite(1, nil, 1, -3); if (rc != -1)