mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 06:50:12 +00:00
tests: Improve fork/waitpid error handling
A couple of places in our test code aren't handling errors from fork() or waitpid() properly. We don't expect to ever hit errors for these, but sysbail() in this case, so they don't fail silently. Change-Id: I1c548f93f4d4ac4344032d7847470b04319386f2 Reviewed-on: https://gerrit.openafs.org/14865 Reviewed-by: Cheyenne Wills <cwills@sinenomine.net> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
parent
a737126035
commit
7448cd159d
@ -441,7 +441,8 @@ int main(int argc, char **argv)
|
||||
printf("Config directory is %s\n", dirname);
|
||||
serverPid = fork();
|
||||
if (serverPid == -1) {
|
||||
/* Bang */
|
||||
sysbail("fork");
|
||||
|
||||
} else if (serverPid == 0) {
|
||||
execl(argv[0], argv[0], "-server", dirname, NULL);
|
||||
ret = 1;
|
||||
|
@ -161,7 +161,9 @@ afstest_StopServer(pid_t serverPid)
|
||||
|
||||
kill(serverPid, SIGTERM);
|
||||
|
||||
waitpid(serverPid, &status, 0);
|
||||
if (waitpid(serverPid, &status, 0) < 0) {
|
||||
sysbail("waitpid");
|
||||
}
|
||||
|
||||
if (WIFSIGNALED(status) && WTERMSIG(status) != SIGTERM) {
|
||||
fprintf(stderr, "Server died exited on signal %d\n", WTERMSIG(status));
|
||||
|
Loading…
Reference in New Issue
Block a user