* tests/test-pread.c (main): Add tests for EBADF.
2011-09-20 Bruno Haible <bruno@clisp.org>
+ pread tests: EBADF tests.
+ * tests/test-pread.c (main): Add tests for EBADF.
+
lseek tests: EBADF tests.
* tests/test-lseek.c (main): Add more tests for EBADF.
ASSERT (errno == ESPIPE);
}
+ /* Test behaviour for invalid file descriptors. */
+ {
+ char byte;
+ errno = 0;
+ ASSERT (pread (-1, &byte, 1, 0) == -1);
+ ASSERT (errno == EBADF);
+ }
+ {
+ char byte;
+ errno = 0;
+ ASSERT (pread (99, &byte, 1, 0) == -1);
+ ASSERT (errno == EBADF);
+ }
+
return 0;
}