]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-path: Set umask explicitly (#8616)
authorFilipe Brandenburger <filbranden@google.com>
Wed, 4 Apr 2018 09:17:19 +0000 (02:17 -0700)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 4 Apr 2018 09:17:19 +0000 (11:17 +0200)
Running `test-path` under an umask such as 027 fails with:

  Assertion '(s.st_mode & S_IRWXO) == 0004' failed at ../src/test/test-path.c:247, function test_path_makedirectory_directorymode(). Aborting.

Looking at directory /tmp/test-path_makedirectory, it was indeed created
with mode 0740, applying the umask to the requested 0744.

Set an explicit umask for this test, to ensure reproducible results.

src/test/test-path.c

index 880e54d81c2fb02560a02cfcfb6fd258bf82d6da..ec9d2626e2c955e6e85bff6dcb2ef74a90a7bb9b 100644 (file)
@@ -20,6 +20,8 @@
 
 #include <stdbool.h>
 #include <stdio.h>
+#include <sys/stat.h>
+#include <sys/types.h>
 
 #include "alloc-util.h"
 #include "fd-util.h"
@@ -266,6 +268,8 @@ int main(int argc, char *argv[]) {
         const test_function_t *test = NULL;
         Manager *m = NULL;
 
+        umask(022);
+
         log_parse_environment();
         log_open();