From 80c45333034887a1b8e77dd62d856c75feef8c8c Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Thu, 28 Apr 2022 10:42:22 -0700 Subject: [PATCH] Unbreak MODE=tiny build This change also fixes a minor issue with pledge() polyfill introduced the last change setting errno appropriately. Fixes #396 --- libc/calls/calls.mk | 1 + libc/mem/pledge.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libc/calls/calls.mk b/libc/calls/calls.mk index 5130f390a..09231eb65 100644 --- a/libc/calls/calls.mk +++ b/libc/calls/calls.mk @@ -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: \ diff --git a/libc/mem/pledge.c b/libc/mem/pledge.c index 6247560bd..b115d719f 100644 --- a/libc/mem/pledge.c +++ b/libc/mem/pledge.c @@ -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)) &&