mirror of git://sourceware.org/git/glibc.git
Tests: Create files with mode 0666, not 0777 (bug 33171)
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>
This commit is contained in:
parent
576976eacc
commit
54bd776f99
|
@ -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. */
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue