From: Graham Percival Date: Mon, 26 Sep 2016 19:50:29 +0000 (-0700) Subject: Add chmod() after make_{dir,file} in test suites X-Git-Tag: v3.2.2~9^2~12^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2623110256c183f88b616451a8258fcb6e8b06ad;p=thirdparty%2Flibarchive.git Add chmod() after make_{dir,file} in test suites 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. --- diff --git a/cat/test/main.c b/cat/test/main.c index 24071baf1..29f7b14b1 100644 --- a/cat/test/main.c +++ b/cat/test/main.c @@ -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; diff --git a/cpio/test/main.c b/cpio/test/main.c index 985a959b5..29bbc37a4 100644 --- a/cpio/test/main.c +++ b/cpio/test/main.c @@ -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; diff --git a/tar/test/main.c b/tar/test/main.c index 1855097f5..3fbefec88 100644 --- a/tar/test/main.c +++ b/tar/test/main.c @@ -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;