bozo: small-notifier: don't ignore return from system()

Nobody can possibly be using this program, but even so, don't ignore
return values.  Unfortunately, the return value of system() is a bit
complicated to interpret.

Change-Id: I6edbbb7c010b4e534de9033b91849e2d54bf4b25
Reviewed-on: http://gerrit.openafs.org/7778
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
Garrett Wollman 2012-07-15 22:34:42 -04:00 committed by Derrick Brashear
parent b9b575c880
commit d2ef4a6e1f

View File

@ -14,6 +14,9 @@
#include <roken.h>
#include <afs/afsutil.h>
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
/*
* XXX CHANGE the following depedent stuff XXX
@ -211,6 +214,18 @@ main(int argc, char **argv)
*/
sprintf(bufp1, "%s %s -s TESTING < %s", SENDMAIL, RECIPIENT, buf);
code = system(bufp1);
if (code == -1)
perror("system");
else if (code == 127)
fprintf(stderr, "system: unable to execute shell\n");
#ifdef WTERMSIG
else if (WIFSIGNALED(code))
fprintf(stderr, "%s terminated with signal %d\n", SENDMAIL,
WTERMSIG(code));
else if (WEXITSTATUS(code) != 0)
fprintf(stderr, "%s exited with status %d\n", SENDMAIL,
WEXITSTATUS(code));
#endif /* WTERMSIG */
unlink(buf);
exit(0);
}