commit 2dc105ebbc70b9961bfbb1238c9d0b9c23a5b8d1
Author: sin <[email protected]>
Date:   Sat Jan 4 14:06:53 2014 +0000

    Use saved errno in case weprintf() fails internally

diff --git a/xargs.c b/xargs.c
index 612f926..75e8731 100644
--- 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)) {


Reply via email to