[hackers] [sbase] Use saved errno in case weprintf() fails internally || sin
commit 2dc105ebbc70b9961bfbb1238c9d0b9c23a5b8d1
Author: sin <sin_AT_2f30.org>
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
_AT_@ -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)) {
Received on Sat Jan 04 2014 - 15:07:39 CET
This archive was generated by hypermail 2.3.0
: Sat Jan 04 2014 - 15:12:09 CET