- errno = 0;
- ASSERT (func (AT_FDCWD, NULL) == -1);
- ASSERT (errno == EBADF);
+ {
+ errno = 0;
+ ASSERT (func (AT_FDCWD, NULL) == -1);
+ ASSERT (errno == EBADF);
+ }
+ {
+ errno = 0;
+ ASSERT (func (-1, NULL) == -1);
+ ASSERT (errno == EBADF);
+ }
+ {
+ close (99);
+ errno = 0;
+ ASSERT (func (99, NULL) == -1);
+ ASSERT (errno == EBADF);
+ }
+ {
+ int fd0 = dup (0);
+ ASSERT (0 <= fd0);
+ ASSERT (close (fd0) == 0);
+ errno = 0;
+ ASSERT (func (fd0, NULL) == -1);
+ ASSERT (errno == EBADF);
+ }