spawn: fix possible NULL dereferences

This commit is contained in:
Jaroslav Kysela 2014-11-16 19:41:02 +01:00
parent b6fcb4523d
commit 114298ad15

View file

@ -108,14 +108,17 @@ spawn_reap(char *stxt, size_t stxtlen)
if (stxt)
snprintf(stxt, stxtlen, "exited, status=%d", WEXITSTATUS(status));
} else if (WIFSIGNALED(status)) {
snprintf(stxt, stxtlen, "killed by signal %d, "
"stopped by signal %d",
WTERMSIG(status),
WSTOPSIG(status));
if (stxt)
snprintf(stxt, stxtlen, "killed by signal %d, "
"stopped by signal %d",
WTERMSIG(status),
WSTOPSIG(status));
} else if (WIFCONTINUED(status)) {
snprintf(stxt, stxtlen, "continued");
if (stxt)
snprintf(stxt, stxtlen, "continued");
} else {
snprintf(stxt, stxtlen, "unknown status");
if (stxt)
snprintf(stxt, stxtlen, "unknown status");
}
if(s != NULL) {