]> granicus.if.org Git - strace/commitdiff
tests/pread64-pwrite64.c: robustify against os specific issues
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 18 May 2016 09:21:54 +0000 (09:21 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 18 May 2016 09:26:01 +0000 (09:26 +0000)
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.

tests/pread64-pwrite64.c

index b1d45de3994090858c34a614258a70a3e03468ad..4a0932a99f610a6d41684787170e7462ab3f50ff 100644 (file)
@@ -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)