commit 8fa8bc6310415d4f13e2321c6281b061bd93c6d0
parent df3011fb893a8246878294523fe1b9a94134f31d
Author: sin <sin@2f30.org>
Date: Wed, 2 Jul 2014 14:17:11 +0100
Print status via standard macros only
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/crond.c b/crond.c
@@ -127,9 +127,13 @@ waitjob(void)
t = time(NULL);
while ((pid = waitpid(-1, &status, WNOHANG | WUNTRACED)) > 0) {
- printf("complete: pid %d, return: %d time: %s", pid, status, ctime(&t));
- fflush(stdout);
- syslog(LOG_INFO, "complete: pid: %d return: %d", pid, status);
+ if (WIFEXITED(status) == 1) {
+ printf("complete: pid %d, return: %d time: %s",
+ pid, WEXITSTATUS(status), ctime(&t));
+ fflush(stdout);
+ syslog(LOG_INFO, "complete: pid: %d return: %d",
+ pid, WEXITSTATUS(status));
+ }
}
}