sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit 2dc105ebbc70b9961bfbb1238c9d0b9c23a5b8d1
parent 567869a8fe138f23a0a2c6cea903747517a81b0a
Author: sin <sin@2f30.org>
Date:   Sat Jan  4 14:06:53 +0000

Use saved errno in case weprintf() fails internally

Diffstat:
xargs.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/xargs.c b/xargs.c @@ -222,15 +222,16 @@ static void runcmd(void) { pid_t pid; - int status; + int status, saved_errno; pid = fork(); if (pid < 0) eprintf("fork:"); if (pid == 0) { execvp(*cmd, cmd); + saved_errno = errno; weprintf("execvp %s:", *cmd); - _exit(errno == ENOENT ? 127 : 126); + _exit(saved_errno == ENOENT ? 127 : 126); } wait(&status); if (WIFEXITED(status)) {