/* Test the pwrite function.
- Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2009-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
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';
+ close (99);
+ errno = 0;
+ ASSERT (pwrite (99, &byte, 1, 0) == -1);
+ ASSERT (errno == EBADF);
+ }
+
return 0;
}