diff --git a/test/libc/calls/pledge_test.c b/test/libc/calls/pledge_test.c index 0f0b07077..1a7755f87 100644 --- a/test/libc/calls/pledge_test.c +++ b/test/libc/calls/pledge_test.c @@ -493,10 +493,12 @@ TEST(pledge, open_cpath) { ASSERT_SYS(0, 0, touch("foo", 0644)); ASSERT_NE(-1, (pid = fork())); if (!pid) { + unsigned omask = umask(022); ASSERT_SYS(0, 0, pledge("stdio cpath", 0)); ASSERT_SYS(0, 3, open("foo", O_WRONLY | O_TRUNC | O_CREAT, 0644)); ASSERT_SYS(0, 0, fstat(3, &st)); ASSERT_EQ(0100644, st.st_mode); + umask(omask); // make sure open() can't apply the setuid bit ASSERT_SYS(EPERM, -1, open("bar", O_WRONLY | O_TRUNC | O_CREAT, 04644)); _Exit(0);