+ if(debug_lvl >= DEBUG_STATUS)
+ syslog(LOG_INFO, _("Executing script %s"), name);
+
+ if(waitpid(pid, &status, 0) == pid)
+ {
+ if(WIFEXITED(status)) /* Child exited by itself */
+ {
+ if(WEXITSTATUS(status))
+ {
+ syslog(LOG_ERR, _("Process %d (%s) exited with non-zero status %d"), pid, name, WEXITSTATUS(status));
+ return -1;
+ }
+ else
+ return 0;
+ }
+ else if(WIFSIGNALED(status)) /* Child was killed by a signal */
+ {
+ syslog(LOG_ERR, _("Process %d (%s) was killed by signal %d (%s)"),
+ pid, name, WTERMSIG(status), strsignal(WTERMSIG(status)));
+ return -1;
+ }
+ else /* Something strange happened */
+ {
+ syslog(LOG_ERR, _("Process %d (%s) terminated abnormally"), pid, name);
+ return -1;
+ }
+ }
+ else
+ {
+ syslog(LOG_ERR, _("System call `%s' failed: %m"), "waitpid");
+ return -1;
+ }