From: Tim Kientzle Date: Mon, 3 Aug 2009 01:41:29 +0000 (-0400) Subject: Use assertMakeDir() instead of mkdir(). X-Git-Tag: v2.8.0~464 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ccad852d9692e1fc38cecd8abdb51f82fdba04f6;p=thirdparty%2Flibarchive.git Use assertMakeDir() instead of mkdir(). SVN-Revision: 1323 --- diff --git a/cpio/test/test_basic.c b/cpio/test/test_basic.c index 1b6a93656..2175ba4e6 100644 --- a/cpio/test/test_basic.c +++ b/cpio/test/test_basic.c @@ -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); diff --git a/cpio/test/test_format_newc.c b/cpio/test/test_format_newc.c index 8d89112fe..2bcfcc6db 100644 --- a/cpio/test/test_format_newc.c +++ b/cpio/test/test_format_newc.c @@ -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: */ diff --git a/cpio/test/test_gcpio_compat.c b/cpio/test/test_gcpio_compat.c index 8b37a1187..30970a8d2 100644 --- a/cpio/test/test_gcpio_compat.c +++ b/cpio/test/test_gcpio_compat.c @@ -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); /* diff --git a/cpio/test/test_option_L_upper.c b/cpio/test/test_option_L_upper.c index 6d78bfd87..a48102f08 100644 --- a/cpio/test/test_option_L_upper.c +++ b/cpio/test/test_option_L_upper.c @@ -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); diff --git a/cpio/test/test_option_c.c b/cpio/test/test_option_c.c index 3edec3021..23808ae5c 100644 --- a/cpio/test/test_option_c.c +++ b/cpio/test/test_option_c.c @@ -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)); diff --git a/cpio/test/test_option_d.c b/cpio/test/test_option_d.c index d40a0165e..57497e291 100644 --- a/cpio/test/test_option_d.c +++ b/cpio/test/test_option_d.c @@ -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); diff --git a/cpio/test/test_option_f.c b/cpio/test/test_option_f.c index 6a8d57012..26640bd07 100644 --- a/cpio/test/test_option_f.c +++ b/cpio/test/test_option_f.c @@ -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); diff --git a/cpio/test/test_option_m.c b/cpio/test/test_option_m.c index 3a67f73b2..e008a5940 100644 --- a/cpio/test/test_option_m.c +++ b/cpio/test/test_option_m.c @@ -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); diff --git a/cpio/test/test_passthrough_dotdot.c b/cpio/test/test_passthrough_dotdot.c index ba28478a4..83c97d86e 100644 --- a/cpio/test/test_passthrough_dotdot.c +++ b/cpio/test/test_passthrough_dotdot.c @@ -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); diff --git a/cpio/test/test_passthrough_reverse.c b/cpio/test/test_passthrough_reverse.c index ab4afad28..cd8efd8ce 100644 --- a/cpio/test/test_passthrough_reverse.c +++ b/cpio/test/test_passthrough_reverse.c @@ -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);