Skip to content

Commit 2891de1

Browse files
committed
Change default umask to 022
1 parent 9619d38 commit 2891de1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

system/lib/libc/emscripten_syscall_stubs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static int g_pid = 42;
2828
static int g_pgid = 42;
2929
static int g_ppid = 1;
3030
static int g_sid = 42;
31-
static mode_t g_umask = S_IWGRP | S_IRWXO;
31+
static mode_t g_umask = S_IWGRP | S_IWOTH;
3232

3333
#ifdef NDEBUG
3434
#define REPORT(name)

test/other/test_umask.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,25 @@ int main() {
3737
// Get the default umask
3838
mode_t default_umask = get_umask();
3939
printf("default umask: %o\n", default_umask);
40-
assert(default_umask == 027);
40+
assert(default_umask == 022);
4141

4242
// Create a new file with default umask
4343
create_file("umask_test_file", "abcdef");
4444
struct stat st;
4545
stat("umask_test_file", &st);
4646
printf("default_umask - stat: %o\n", st.st_mode);
47-
assert((st.st_mode & 0666) == 0640);
47+
assert((st.st_mode & 0666) == 0644);
4848
unlink("umask_test_file");
4949

5050
// Set new umask
51-
mode_t new_umask = 022;
51+
mode_t new_umask = 027;
5252
mode_t old_umask = umask(new_umask);
5353

5454
// Create a new file with new umask
5555
create_file("umask_test_file", "abcdef");
5656
stat("umask_test_file", &st);
5757
printf("new_umask - stat: %o\n", st.st_mode);
58-
assert((st.st_mode & 0666) == 0644);
58+
assert((st.st_mode & 0666) == 0640);
5959

6060
// Restore the old umask
6161
umask(old_umask);

0 commit comments

Comments
 (0)