mirror of
git://git.suckless.org/sbase
synced 2024-12-26 00:42:35 +00:00
Use saved errno in case weprintf() fails internally
This commit is contained in:
parent
567869a8fe
commit
2dc105ebbc
5
xargs.c
5
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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user