Unbreak MODE=tiny build

This change also fixes a minor issue with pledge() polyfill introduced
the last change setting errno appropriately.

Fixes #396
This commit is contained in:
Justine Tunney 2022-04-28 10:42:22 -07:00
parent 47b3274665
commit 80c4533303
2 changed files with 8 additions and 2 deletions

View file

@ -112,6 +112,7 @@ o/$(MODE)/libc/calls/execlp.o \
o/$(MODE)/libc/calls/copyfile.o \
o/$(MODE)/libc/calls/execve-nt.o \
o/$(MODE)/libc/calls/execve-sysv.o \
o/$(MODE)/libc/calls/symlinkat-nt.o \
o/$(MODE)/libc/calls/readlinkat-nt.o \
o/$(MODE)/libc/calls/describeopenflags.greg.o \
o/$(MODE)/libc/calls/mkntenvblock.o: \

View file

@ -322,9 +322,14 @@ static int sys_pledge_linux(const char *promises, const char *execpromises) {
AppendFilter(&f, kFilterStart, ARRAYLEN(kFilterStart)) &&
AppendPledge(&f, kPledgeLinuxDefault)) {
for (ok = true; (tok = strtok_r(start, " \t\r\n", &state)); start = 0) {
if (!(pledge = FindPledge(kPledgeLinux, tok)) ||
!AppendPledge(&f, pledge)) {
if (!(pledge = FindPledge(kPledgeLinux, tok))) {
ok = false;
rc = einval();
break;
}
if (!AppendPledge(&f, pledge)) {
ok = false;
break;
}
}
if (ok && AppendFilter(&f, kFilterEnd, ARRAYLEN(kFilterEnd)) &&