The current implementation of command_finish always calls WEXITSTATUS,
despite the man page for waitpid stating that WEXITSTATUS should only
be used if WIFEXITED returned true.
This change will set the exit status of k5start accordingly by either
using WTERMSIG if WIFSIGNALED returns true, and using WEXITSTATUS if
WIFEXITETED returns true. This means that the user can check the exit
status of the command running under k5start and know if the command
failed. Looking at the following example, in the previous code, the
command would print 0, now it will print 143. This will match the
functionality of bash [0].
$ k5start -f ./user.keytab -- sh -c 'kill $$'; echo $?
143
$ sh -c 'kill $$'; echo $?
143
This also makes a minor change by only setting the status if it is a
non-null pointer.