- if(waitpid(pid, &status, 0) == pid) {
- if(WIFEXITED(status)) { /* Child exited by itself */
- if(WEXITSTATUS(status)) {
- logger(LOG_ERR, _("Process %d (%s) exited with non-zero status %d"),
- pid, name, WEXITSTATUS(status));
- return false;
- } else
- return true;
- } else if(WIFSIGNALED(status)) { /* Child was killed by a signal */
- logger(LOG_ERR, _("Process %d (%s) was killed by signal %d (%s)"), pid,
- name, WTERMSIG(status), strsignal(WTERMSIG(status)));
- return false;
- } else { /* Something strange happened */
- logger(LOG_ERR, _("Process %d (%s) terminated abnormally"), pid,
- name);
+ for(i = 0; envp[i]; i++) {
+ putenv(envp[i]);
+ }
+
+ scriptname[len - 1] = '\"';
+ status = system(scriptname);
+
+ free(scriptname);
+
+ /* Unset environment */
+
+ for(i = 0; envp[i]; i++) {
+ unputenv(envp[i]);
+ }
+
+ if(status != -1) {
+#ifdef WEXITSTATUS
+
+ if(WIFEXITED(status)) { /* Child exited by itself */
+ if(WEXITSTATUS(status)) {
+ logger(LOG_ERR, "Script %s exited with non-zero status %d",
+ name, WEXITSTATUS(status));