int main (void) { /* FIXME: Add tests of fd other than ".". */ int result1; int result2; /* Remove any leftovers from a previous partial run. */ ignore_value (system ("rm -rf " BASE "*")); result1 = test_rmdir_func (rmdirat, false); result2 = test_unlink_func (unlinker, false); ASSERT (result1 == result2); dfd = open (".", O_RDONLY); ASSERT (0 <= dfd); result2 = test_rmdir_func (rmdirat, false); ASSERT (result1 == result2); result2 = test_unlink_func (unlinker, false); ASSERT (result1 == result2); ASSERT (close (dfd) == 0); if (result1 == 77) fputs ("skipping test: symlinks not supported on this file system\n", stderr); return result1; }
int main (void) { /* Remove any leftovers from a previous partial run. */ ignore_value (system ("rm -rf " BASE "*")); return test_rmdir_func (rmdir, true); }
int main (int argc _GL_UNUSED, char *argv[]) { /* FIXME: Add tests of fd other than ".". */ int result1; int result2; set_program_name (argv[0]); /* Remove any leftovers from a previous partial run. */ ignore_value (system ("rm -rf " BASE "*")); /* Test behaviour for invalid file descriptors. */ { errno = 0; ASSERT (unlinkat (-1, "foo", 0) == -1); ASSERT (errno == EBADF); } { errno = 0; ASSERT (unlinkat (99, "foo", 0) == -1); ASSERT (errno == EBADF); } result1 = test_rmdir_func (rmdirat, false); result2 = test_unlink_func (unlinker, false); ASSERT (result1 == result2); dfd = open (".", O_RDONLY); ASSERT (0 <= dfd); result2 = test_rmdir_func (rmdirat, false); ASSERT (result1 == result2); result2 = test_unlink_func (unlinker, false); ASSERT (result1 == result2); ASSERT (close (dfd) == 0); if (result1 == 77) fputs ("skipping test: symlinks not supported on this file system\n", stderr); return result1; }