]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Use assertUmask() instead of unchecked umask().
authorTim Kientzle <kientzle@gmail.com>
Mon, 3 Aug 2009 01:45:31 +0000 (21:45 -0400)
committerTim Kientzle <kientzle@gmail.com>
Mon, 3 Aug 2009 01:45:31 +0000 (21:45 -0400)
SVN-Revision: 1324

cpio/test/test_basic.c
cpio/test/test_format_newc.c
cpio/test/test_gcpio_compat.c
cpio/test/test_option_c.c
cpio/test/test_passthrough_dotdot.c
cpio/test/test_passthrough_reverse.c

index 2175ba4e65999a2bc3e3ee85c1d1fea279a16881..2e0ed3b092d9dc5b9e1bd8f9e3f7ce002f5fe713 100644 (file)
@@ -183,9 +183,8 @@ DEFINE_TEST(test_basic)
 {
        int fd;
        int filelist;
-       int oldumask;
 
-       oldumask = umask(0);
+       assertUmask(0);
 
        /*
         * Create an assortment of files on disk.
@@ -220,7 +219,7 @@ DEFINE_TEST(test_basic)
        /* All done. */
        close(filelist);
 
-       umask(022);
+       assertUmask(022);
 
        /* Archive/dearchive with a variety of options. */
        basic_cpio("copy", "", "", "2 blocks\n");
@@ -239,6 +238,4 @@ DEFINE_TEST(test_basic)
 #endif
        /* Copy in one step using -p */
        passthrough("passthrough");
-
-       umask(oldumask);
 }
index 2bcfcc6db206185f36610307fed02b371ac2fd35..bbe3dcd4faee6b8d09d65405a6933cea5f3d4385 100644 (file)
@@ -69,9 +69,8 @@ DEFINE_TEST(test_format_newc)
        time_t t, t2, now;
        char *p, *e;
        size_t s, fs, ns;
-       mode_t oldmask;
 
-       oldmask = umask(0);
+       assertUmask(0);
 
        /*
         * Create an assortment of files.
@@ -284,6 +283,4 @@ DEFINE_TEST(test_format_newc)
        assertEqualMem(e + 110, "TRAILER!!!\0\0", 12); /* Name */
 
        free(p);
-
-       umask(oldmask);
 }
index 30970a8d2832e84f9906a70d8131c01565553174..c5e80575b51d47ada454cedc7b18069fb0a82490 100644 (file)
@@ -111,9 +111,7 @@ unpack_test(const char *from, const char *options, const char *se)
 
 DEFINE_TEST(test_gcpio_compat)
 {
-       int oldumask;
-
-       oldumask = umask(0);
+       assertUmask(0);
 
        /* Dearchive sample files with a variety of options. */
        unpack_test("test_gcpio_compat_ref.bin", "--no-preserve-owner", "1 block\n");
@@ -121,6 +119,4 @@ DEFINE_TEST(test_gcpio_compat)
        unpack_test("test_gcpio_compat_ref.newc", "--no-preserve-owner", "2 blocks\n");
        /* gcpio-2.9 only reads 6 blocks here */
        unpack_test("test_gcpio_compat_ref.ustar", "--no-preserve-owner", "7 blocks\n");
-
-       umask(oldumask);
 }
index 23808ae5c7b010bf36c4d921c047ea5f6b808944..7270187ece9f8802605c6cd9751fb89fe54b43fd 100644 (file)
@@ -59,9 +59,8 @@ DEFINE_TEST(test_option_c)
        time_t t, now;
        char *p, *e;
        size_t s;
-       mode_t oldmask;
 
-       oldmask = umask(0);
+       assertUmask(0);
 
        /*
         * Create an assortment of files.
@@ -222,6 +221,4 @@ DEFINE_TEST(test_option_c)
        assertEqualMem(e + 76, "TRAILER!!!\0", 11); /* Name */
 
        free(p);
-
-       umask(oldmask);
 }
index 83c97d86ed222ee20655caf87060f94f55d63a24..9dc8dbb0d08e90b6762b6abdf188333619b6fb9c 100644 (file)
@@ -34,9 +34,8 @@ DEFINE_TEST(test_passthrough_dotdot)
        struct stat st;
        int fd, r;
        int filelist;
-       int oldumask;
 
-       oldumask = umask(0);
+       assertUmask(0);
 
        /*
         * Create an assortment of files on disk.
@@ -88,6 +87,4 @@ DEFINE_TEST(test_passthrough_dotdot)
                assertEqualInt(10, st.st_size);
                assertEqualInt(1, st.st_nlink);
        }
-
-       umask(oldumask);
 }
index cd8efd8ce363c1d1354fca897cae056796ef17d1..25ba73b563a1d9e9b49d2fecf28c12d1e08c10fd 100644 (file)
@@ -39,9 +39,8 @@ DEFINE_TEST(test_passthrough_reverse)
        struct stat st;
        int fd, r;
        int filelist;
-       int oldumask;
 
-       oldumask = umask(0);
+       assertUmask(0);
 
        /*
         * Create an assortment of files on disk.
@@ -107,6 +106,4 @@ DEFINE_TEST(test_passthrough_reverse)
                assertEqualInt(10, st.st_size);
                assertEqualInt(1, st.st_nlink);
        }
-
-       umask(oldumask);
 }