]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Use assertMakeDir() instead of mkdir().
authorTim Kientzle <kientzle@gmail.com>
Mon, 3 Aug 2009 01:41:29 +0000 (21:41 -0400)
committerTim Kientzle <kientzle@gmail.com>
Mon, 3 Aug 2009 01:41:29 +0000 (21:41 -0400)
SVN-Revision: 1323

cpio/test/test_basic.c
cpio/test/test_format_newc.c
cpio/test/test_gcpio_compat.c
cpio/test/test_option_L_upper.c
cpio/test/test_option_c.c
cpio/test/test_option_d.c
cpio/test/test_option_f.c
cpio/test/test_option_m.c
cpio/test/test_passthrough_dotdot.c
cpio/test/test_passthrough_reverse.c

index 1b6a93656e128cb2a960425eb990c88c0329eddb..2175ba4e65999a2bc3e3ee85c1d1fea279a16881 100644 (file)
@@ -120,7 +120,7 @@ basic_cpio(const char *target,
 {
        int r;
 
-       if (!assertEqualInt(0, mkdir(target, 0775)))
+       if (!assertMakeDir(target, 0775))
            return;
 
        /* Use the cpio program to create an archive. */
@@ -157,7 +157,7 @@ passthrough(const char *target)
 {
        int r;
 
-       if (!assertEqualInt(0, mkdir(target, 0775)))
+       if (!assertMakeDir(target, 0775))
                return;
 
        /*
@@ -215,7 +215,7 @@ DEFINE_TEST(test_basic)
        write(filelist, "file2\n", 6);
 
        /* Directory. */
-       assertEqualInt(0, mkdir("dir", 0775));
+       assertMakeDir("dir", 0775);
        write(filelist, "dir\n", 4);
        /* All done. */
        close(filelist);
index 8d89112feb726de040a214531973a71ffa9b6986..2bcfcc6db206185f36610307fed02b371ac2fd35 100644 (file)
@@ -98,7 +98,7 @@ DEFINE_TEST(test_format_newc)
        assertEqualInt(8, write(list, "symlink\n", 8));
 
        /* "dir" */
-       assertEqualInt(0, mkdir("dir", 0775));
+       assertMakeDir("dir", 0775);
        assertEqualInt(4, write(list, "dir\n", 4));
 
        /* Record some facts about what we just created: */
index 8b37a118788e895236fd892929fc0823874ef58a..30970a8d2832e84f9906a70d8131c01565553174 100644 (file)
@@ -32,7 +32,7 @@ unpack_test(const char *from, const char *options, const char *se)
        int r;
 
        /* Create a work dir named after the file we're unpacking. */
-       assertEqualInt(0, mkdir(from, 0775));
+       assertMakeDir(from, 0775);
        assertChdir(from);
 
        /*
index 6d78bfd870c96c34ca875ddf030655c9117796a6..a48102f085f9ddc962e2bde2521c9ac2a80a2bc9 100644 (file)
@@ -72,7 +72,7 @@ DEFINE_TEST(test_option_L_upper)
        failure("Error invoking %s -o ", testprog);
        assertEqualInt(r, 0);
 
-       assertEqualInt(0, mkdir("unpack", 0755));
+       assertMakeDir("unpack", 0755);
 #if defined(_WIN32) && !defined(__CYGWIN__)
        assertChdir("unpack");
        r = systemf("type ..\\archive.out | %s -i >unpack.out 2>unpack.err", testprog);
@@ -91,7 +91,7 @@ DEFINE_TEST(test_option_L_upper)
        failure("Error invoking %s -oL", testprog);
        assertEqualInt(r, 0);
 
-       assertEqualInt(0, mkdir("unpack-L", 0755));
+       assertMakeDir("unpack-L", 0755);
 #if defined(_WIN32) && !defined(__CYGWIN__)
        assertChdir("unpack-L");
        r = systemf("type ..\\archive-L.out | %s -i >unpack-L.out 2>unpack-L.err", testprog);
index 3edec3021939e48badcb3271eaa66d1ba40625d8..23808ae5c7b010bf36c4d921c047ea5f6b808944 100644 (file)
@@ -81,7 +81,7 @@ DEFINE_TEST(test_option_c)
        assertEqualInt(8, write(filelist, "symlink\n", 8));
 
        /* "dir" */
-       assertEqualInt(0, mkdir("dir", 0775));
+       assertMakeDir("dir", 0775);
        /* Record some facts about what we just created: */
        now = time(NULL); /* They were all created w/in last two seconds. */
        assertEqualInt(4, write(filelist, "dir\n", 4));
index d40a0165e4b2e912ecd4c517f70c4c9bbf7c11ea..57497e29112ce3f2470878abe71deaa0982614f5 100644 (file)
@@ -34,7 +34,7 @@ DEFINE_TEST(test_option_d)
        /*
         * Create a file in a directory.
         */
-       assertEqualInt(0, mkdir("dir", 0755));
+       assertMakeDir("dir", 0755);
        fd = open("dir/file", O_CREAT | O_WRONLY, 0644);
        assert(fd >= 0);
        close(fd);
@@ -47,7 +47,7 @@ DEFINE_TEST(test_option_d)
        assertEqualInt(512, st.st_size);
 
        /* Dearchive without -d, this should fail. */
-       assertEqualInt(0, mkdir("without-d", 0755));
+       assertMakeDir("without-d", 0755);
        assertChdir("without-d");
        r = systemf("%s -i < ../archive.cpio >out 2>err", testprog);
        assertEqualInt(r, 0);
@@ -57,7 +57,7 @@ DEFINE_TEST(test_option_d)
 
        /* Dearchive with -d, this should succeed. */
        assertChdir("..");
-       assertEqualInt(0, mkdir("with-d", 0755));
+       assertMakeDir("with-d", 0755);
        assertChdir("with-d");
        r = systemf("%s -id < ../archive.cpio >out 2>err", testprog);
        assertEqualInt(r, 0);
index 6a8d57012e165dc44cff4e2d5ecca201f8ac8f3f..26640bd071334b937fd917c24c33d47471b9f15c 100644 (file)
@@ -33,7 +33,7 @@ unpack(const char *dirname, const char *option)
 {
        int r;
 
-       assertEqualInt(0, mkdir(dirname, 0755));
+       assertMakeDir(dirname, 0755);
        assertChdir(dirname);
        extract_reference_file("test_option_f.cpio");
        r = systemf("%s -i %s < test_option_f.cpio > copy-no-a.out 2>copy-no-a.err", testprog, option);
index 3a67f73b28c4b38f3d32955790c2f2b893ff234a..e008a594038107827e46a3dfa70771419b3b8635 100644 (file)
@@ -38,7 +38,7 @@ DEFINE_TEST(test_option_m)
         */
 
        /* Restored without -m, the result should have a current mtime. */
-       assertEqualInt(0, mkdir("without-m", 0755));
+       assertMakeDir("without-m", 0755);
        assertChdir("without-m");
        extract_reference_file("test_option_m.cpio");
        r = systemf("%s --no-preserve-owner -i < test_option_m.cpio >out 2>err", testprog);
@@ -53,7 +53,7 @@ DEFINE_TEST(test_option_m)
 
        /* With -m, it should have an mtime in 1970. */
        assertChdir("..");
-       assertEqualInt(0, mkdir("with-m", 0755));
+       assertMakeDir("with-m", 0755);
        assertChdir("with-m");
        extract_reference_file("test_option_m.cpio");
        r = systemf("%s --no-preserve-owner -im < test_option_m.cpio >out 2>err", testprog);
index ba28478a41121100cc542bf9a0c7b52fbd194f5d..83c97d86ed222ee20655caf87060f94f55d63a24 100644 (file)
@@ -44,7 +44,7 @@ DEFINE_TEST(test_passthrough_dotdot)
        filelist = open("filelist", O_CREAT | O_WRONLY, 0644);
 
        /* Directory. */
-       assertEqualInt(0, mkdir("dir", 0755));
+       assertMakeDir("dir", 0755);
        assertChdir("dir");
 
        write(filelist, ".\n", 2);
index ab4afad28775d74e39881235cf521dcebd147f6c..cd8efd8ce363c1d1354fca897cae056796ef17d1 100644 (file)
@@ -49,7 +49,7 @@ DEFINE_TEST(test_passthrough_reverse)
        filelist = open("filelist", O_CREAT | O_WRONLY, 0644);
 
        /* Directory. */
-       assertEqualInt(0, mkdir("dir", 0743));
+       assertMakeDir("dir", 0743);
 
        /* File with 10 bytes content. */
        fd = open("dir/file", O_CREAT | O_WRONLY, 0644);