Mercurial > hg > octave-lojdl > gnulib-hg
changeset 15692:5894e787ef49
pread tests: EBADF tests.
* tests/test-pread.c (main): Add tests for EBADF.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Tue, 20 Sep 2011 22:12:22 +0200 |
parents | fdd4144a456b |
children | bc4a7eb2598f |
files | ChangeLog tests/test-pread.c |
diffstat | 2 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 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.
--- a/tests/test-pread.c +++ b/tests/test-pread.c @@ -83,5 +83,19 @@ 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; }