Return proper exit code when exec*() functions fail
- the correct exit code should be 127 accoring to bash(1), we want to keep the same exit code behaviour as bash for rpm
This commit is contained in:
parent
73f61ecf05
commit
faaa0305f5
|
@ -187,7 +187,7 @@ fprintf(stderr, "*** rootDir %s buildDir %s\n", rootDir, buildDir);
|
|||
rpmlog(RPMLOG_ERR, _("Exec of %s failed (%s): %s\n"),
|
||||
scriptName, name, strerror(errno));
|
||||
|
||||
_exit(-1);
|
||||
_exit(127); /* exit 127 for compatibility with bash(1) */
|
||||
}
|
||||
|
||||
pid = waitpid(child, &status, 0);
|
||||
|
|
|
@ -658,7 +658,7 @@ static void doScriptExec(rpmts ts, ARGV_const_t argv, rpmtd prefixes,
|
|||
xx = execv(argv[0], argv);
|
||||
}
|
||||
}
|
||||
_exit(-1);
|
||||
_exit(127); /* exit 127 for compatibility with bash(1) */
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -268,7 +268,7 @@ int urlGetFile(const char * url, const char * dest)
|
|||
ARGV_t argv = NULL;
|
||||
argvSplit(&argv, cmd, " ");
|
||||
execvp(argv[0], argv);
|
||||
exit(-1); /* error out if exec fails */
|
||||
exit(127); /* exit with 127 for compatibility with bash(1) */
|
||||
}
|
||||
wait = waitpid(pid, &rc, 0);
|
||||
cmd = _free(cmd);
|
||||
|
|
Loading…
Reference in New Issue