* tests/test-pwrite.c (main): Add tests for EBADF.
2011-09-20 Bruno Haible <bruno@clisp.org>
+ pwrite tests: EBADF tests.
+ * tests/test-pwrite.c (main): Add tests for EBADF.
+
pread tests: EBADF tests.
* tests/test-pread.c (main): Add tests for EBADF.
ASSERT (close (fd) == 0);
ASSERT (strcmp ("W1W3W5W7W9",buf) == 0);
}
+
+ /* Test behaviour for invalid file descriptors. */
+ {
+ char byte = 'x';
+ errno = 0;
+ ASSERT (pwrite (-1, &byte, 1, 0) == -1);
+ ASSERT (errno == EBADF);
+ }
+ {
+ char byte = 'x';
+ errno = 0;
+ ASSERT (pwrite (99, &byte, 1, 0) == -1);
+ ASSERT (errno == EBADF);
+ }
+
return 0;
}