diff options
author | Florian Weimer <fweimer@redhat.com> | 2025-09-01 15:05:16 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2025-09-01 15:12:28 +0200 |
commit | 54bd776f991f1a228a6bb6d76bf542edd915a0e3 (patch) | |
tree | babbe74424fc1827e421e423f7bc0fcc061d99b3 | |
parent | 576976eacc6af024ec17bea7a2247b1a4e31f2dc (diff) | |
download | glibc-54bd776f991f1a228a6bb6d76bf542edd915a0e3.zip glibc-54bd776f991f1a228a6bb6d76bf542edd915a0e3.tar.gz glibc-54bd776f991f1a228a6bb6d76bf542edd915a0e3.tar.bz2 |
Mode 0777 should be used for directories only because it results
in executable entries (after typical umasks are applied).
Reviewed-by: Arjun Shankar <arjun@redhat.com>
-rw-r--r-- | io/tst-ftw-lnk.c | 2 | ||||
-rw-r--r-- | posix/tst-spawn-chdir.c | 4 | ||||
-rw-r--r-- | stdio-common/tst-setvbuf2.c | 7 | ||||
-rw-r--r-- | stdlib/test-canon.c | 2 | ||||
-rw-r--r-- | support/shell-container.c | 8 | ||||
-rw-r--r-- | support/test-container.c | 2 |
6 files changed, 12 insertions, 13 deletions
diff --git a/io/tst-ftw-lnk.c b/io/tst-ftw-lnk.c index 88f1926..4538f35 100644 --- a/io/tst-ftw-lnk.c +++ b/io/tst-ftw-lnk.c @@ -217,7 +217,7 @@ do_test (void) FAIL_EXIT1 ("symlink link1-bad failed"); if (symlink ("link2-tgt", "link2-ok") < 0) FAIL_EXIT1 ("symlink link2-ok failed"); - if (open ("link2-tgt", O_RDWR|O_CREAT, 0777) < 0) + if (open ("link2-tgt", O_RDWR|O_CREAT, 0666) < 0) FAIL_EXIT1 ("create of link2-tgt failed"); /* Now we run the tests. */ diff --git a/posix/tst-spawn-chdir.c b/posix/tst-spawn-chdir.c index b97cd3a..1b1323f 100644 --- a/posix/tst-spawn-chdir.c +++ b/posix/tst-spawn-chdir.c @@ -156,13 +156,13 @@ do_test (void) TEST_COMPARE (posix_spawn_file_actions_addopen (&actions, 3, /* Arbitrary unused descriptor. */ "probe-file", - O_WRONLY | O_CREAT | O_EXCL, 0777), 0); + O_WRONLY | O_CREAT | O_EXCL, 0666), 0); TEST_COMPARE (posix_spawn_file_actions_addclose (&actions, 3), 0); /* Run the actual in iteration_directory. */ add_chdir (&actions, "..", do_fchdir, 5); TEST_COMPARE (posix_spawn_file_actions_addopen (&actions, STDOUT_FILENO, "output-file", - O_WRONLY | O_CREAT | O_EXCL, 0777), 0); + O_WRONLY | O_CREAT | O_EXCL, 0666), 0); /* Check that posix_spawn_file_actions_addchdir_np made a copy of the path. */ diff --git a/stdio-common/tst-setvbuf2.c b/stdio-common/tst-setvbuf2.c index 84d8b43..d791b19 100644 --- a/stdio-common/tst-setvbuf2.c +++ b/stdio-common/tst-setvbuf2.c @@ -265,7 +265,7 @@ writer_thread_proc (void *closure) debug; if (td->fname) - td->fd = xopen (td->fname, O_WRONLY, 0777); + td->fd = xopen (td->fname, O_WRONLY, 0666); fd = td->fd; while (1) @@ -292,7 +292,7 @@ reader_thread_proc (void *closure) debug; if (td->fname) - td->fd = xopen (td->fname, O_RDONLY, 0777); + td->fd = xopen (td->fname, O_RDONLY, 0666); fd = td->fd; while (1) @@ -538,7 +538,7 @@ open_test_stream (enum test_source_case f, enum test_stream_case s) break; case test_stream_fdopen_w: - fd = xopen (fname, O_WRONLY|O_CREAT|O_TRUNC, 0777); + fd = xopen (fname, O_WRONLY|O_CREAT|O_TRUNC, 0666); fp = fdopen (fd, "w"); break; @@ -1030,4 +1030,3 @@ do_test (void) # include <support/test-driver.c> #endif - diff --git a/stdlib/test-canon.c b/stdlib/test-canon.c index 51b0af1..51ac60d 100644 --- a/stdlib/test-canon.c +++ b/stdlib/test-canon.c @@ -165,7 +165,7 @@ do_test (int argc, char ** argv) int has_dir = mkdir ("doesExist", 0777) == 0; - int fd = has_dir ? creat ("doesExist/someFile", 0777) : -1; + int fd = has_dir ? creat ("doesExist/someFile", 0666) : -1; for (i = 0; i < (int) (sizeof (tests) / sizeof (tests[0])); ++i) { diff --git a/support/shell-container.c b/support/shell-container.c index dcf53ad..06f3212 100644 --- a/support/shell-container.c +++ b/support/shell-container.c @@ -237,25 +237,25 @@ run_command_array (char **argv) { if (strcmp (argv[i], "<") == 0 && argv[i + 1]) { - new_stdin = open (argv[i + 1], O_WRONLY|O_CREAT|O_TRUNC, 0777); + new_stdin = open (argv[i + 1], O_WRONLY|O_CREAT|O_TRUNC, 0666); ++i; continue; } if (strcmp (argv[i], ">") == 0 && argv[i + 1]) { - new_stdout = open (argv[i + 1], O_WRONLY|O_CREAT|O_TRUNC, 0777); + new_stdout = open (argv[i + 1], O_WRONLY|O_CREAT|O_TRUNC, 0666); ++i; continue; } if (strcmp (argv[i], ">>") == 0 && argv[i + 1]) { - new_stdout = open (argv[i + 1], O_WRONLY|O_CREAT|O_APPEND, 0777); + new_stdout = open (argv[i + 1], O_WRONLY|O_CREAT|O_APPEND, 0666); ++i; continue; } if (strcmp (argv[i], "2>") == 0 && argv[i + 1]) { - new_stderr = open (argv[i + 1], O_WRONLY|O_CREAT|O_TRUNC, 0777); + new_stderr = open (argv[i + 1], O_WRONLY|O_CREAT|O_TRUNC, 0666); ++i; continue; } diff --git a/support/test-container.c b/support/test-container.c index 1c40ab3..ae643d3 100644 --- a/support/test-container.c +++ b/support/test-container.c @@ -273,7 +273,7 @@ devmount (const char *new_root_path, const char *which) { int fd; fd = open (concat (new_root_path, "/dev/", which, NULL), - O_CREAT | O_TRUNC | O_RDWR, 0777); + O_CREAT | O_TRUNC | O_RDWR, 0666); xclose (fd); trymount (concat ("/dev/", which, NULL), |