]> git.saurik.com Git - apple/xnu.git/blob - tests/fduiomove.c
xnu-7195.101.1.tar.gz
[apple/xnu.git] / tests / fduiomove.c
1 #include <darwintest.h>
2 #include <darwintest_utils.h>
3 #include <crt_externs.h>
4 #include <sys/types.h>
5 #include <sys/uio.h>
6 #include <unistd.h>
7 #include <fcntl.h>
8
9 T_GLOBAL_META(
10 T_META_RUN_CONCURRENTLY(true),
11 T_META_LTEPHASE(LTE_POSTINIT)
12 );
13
14 T_DECL(fd_invalid_pread, "Test for 66711697: make sure we get EFAULT")
15 {
16 int fd;
17 ssize_t rc;
18
19 fd = open(*_NSGetProgname(), O_RDONLY);
20 T_ASSERT_POSIX_SUCCESS(fd, "open(self)");
21
22 rc = pread(fd, (void *)~0, 64 << 10, 0);
23 T_ASSERT_POSIX_FAILURE(rc, EFAULT, "pread should fail with EFAULT");
24
25 close(fd);
26 }