]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Add chmod() after make_{dir,file} in test suites 788/head
authorGraham Percival <gperciva@tarsnap.com>
Mon, 26 Sep 2016 19:50:29 +0000 (12:50 -0700)
committerGraham Percival <gperciva@tarsnap.com>
Mon, 26 Sep 2016 19:50:29 +0000 (12:50 -0700)
This is the same change that
    38b3f516df865e2dffd0a1bbc9feb923ab2efc38
made to
    libarchive/test/main.c
, but now applied to:
    cat/test/main.c
    cpio/test/main.c
    tar/test/main.c

Sponsored by: Tarsnap Backup Inc.

cat/test/main.c
cpio/test/main.c
tar/test/main.c

index 24071baf18e3f46d166471ef8e50817965f99b99..29f7b14b1849746a490b669c6513fcbb957a128c 100644 (file)
@@ -1604,8 +1604,10 @@ assertion_make_dir(const char *file, int line, const char *dirname, int mode)
                return (1);
 #else
        if (0 == mkdir(dirname, mode)) {
-               assertion_file_mode(file, line, dirname, mode);
-               return (1);
+               if (0 == chmod(dirname, mode)) {
+                       assertion_file_mode(file, line, dirname, mode);
+                       return (1);
+               }
        }
 #endif
        failure_start(file, line, "Could not create directory %s", dirname);
@@ -1655,6 +1657,11 @@ assertion_make_file(const char *file, int line,
                failure_finish(NULL);
                return (0);
        }
+       if (0 != chmod(path, mode)) {
+               failure_start(file, line, "Could not chmod %s", path);
+               failure_finish(NULL);
+               return (0);
+       }
        if (contents != NULL) {
                ssize_t wsize;
 
index 985a959b510bec93861d45b237cfe8388f1560cb..29bbc37a46bbf8263f645c7f7faf3bf559f1d0e1 100644 (file)
@@ -1605,8 +1605,10 @@ assertion_make_dir(const char *file, int line, const char *dirname, int mode)
                return (1);
 #else
        if (0 == mkdir(dirname, mode)) {
-               assertion_file_mode(file, line, dirname, mode);
-               return (1);
+               if (0 == chmod(dirname, mode)) {
+                       assertion_file_mode(file, line, dirname, mode);
+                       return (1);
+               }
        }
 #endif
        failure_start(file, line, "Could not create directory %s", dirname);
@@ -1656,6 +1658,11 @@ assertion_make_file(const char *file, int line,
                failure_finish(NULL);
                return (0);
        }
+       if (0 != chmod(path, mode)) {
+               failure_start(file, line, "Could not chmod %s", path);
+               failure_finish(NULL);
+               return (0);
+       }
        if (contents != NULL) {
                ssize_t wsize;
 
index 1855097f552bc9ce6993cb528d3fd2958c9b4cc3..3fbefec88f2b86ad6ddf3360672a2f22026bb863 100644 (file)
@@ -1605,8 +1605,10 @@ assertion_make_dir(const char *file, int line, const char *dirname, int mode)
                return (1);
 #else
        if (0 == mkdir(dirname, mode)) {
-               assertion_file_mode(file, line, dirname, mode);
-               return (1);
+               if (0 == chmod(dirname, mode)) {
+                       assertion_file_mode(file, line, dirname, mode);
+                       return (1);
+               }
        }
 #endif
        failure_start(file, line, "Could not create directory %s", dirname);
@@ -1656,6 +1658,11 @@ assertion_make_file(const char *file, int line,
                failure_finish(NULL);
                return (0);
        }
+       if (0 != chmod(path, mode)) {
+               failure_start(file, line, "Could not chmod %s", path);
+               failure_finish(NULL);
+               return (0);
+       }
        if (contents != NULL) {
                ssize_t wsize;