mirror of
https://https.git.savannah.gnu.org/git/gnulib.git
synced 2026-09-01 11:16:02 +00:00
pwrite tests: EBADF tests.
* tests/test-pwrite.c (main): Add tests for EBADF.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
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.
|
||||
|
||||
|
||||
@@ -76,5 +76,20 @@ main (void)
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user