From: Tim Kientzle Date: Sat, 4 Apr 2009 20:29:11 +0000 (-0400) Subject: Some privileged users can write to non-writable directories, X-Git-Tag: v2.7.0~28 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c03caf45bfd487fc822d0f214930b1569e14dff0;p=thirdparty%2Flibarchive.git Some privileged users can write to non-writable directories, so this test needs to be skipped in that situation. SVN-Revision: 913 --- diff --git a/libarchive/test/test_write_disk_failures.c b/libarchive/test/test_write_disk_failures.c index d72a2ad73..c0e1f8fb9 100644 --- a/libarchive/test/test_write_disk_failures.c +++ b/libarchive/test/test_write_disk_failures.c @@ -39,6 +39,7 @@ DEFINE_TEST(test_write_disk_failures) #else struct archive_entry *ae; struct archive *a; + int fd; /* Force the umask to something predictable. */ umask(UMASK); @@ -46,6 +47,15 @@ DEFINE_TEST(test_write_disk_failures) /* A directory that we can't write to. */ assertEqualInt(0, mkdir("dir", 0555)); + /* Can we? */ + fd = open("dir/testfile", O_WRONLY | O_CREAT); + if (fd >= 0) { + /* Apparently, we can, so the test below won't work. */ + close(fd); + skipping("Can't test writing to non-writable directory"); + return; + } + /* Try to extract a regular file into the directory above. */ assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "dir/file");