We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7c3c3c3 + e1b14e6 commit d3face3Copy full SHA for d3face3
src/util.c
@@ -117,8 +117,19 @@ execute(const char *cmd_line, int quiet)
117
debug(LOG_DEBUG, "Waiting for PID %d to exit", pid);
118
rc = waitpid(pid, &status, 0);
119
debug(LOG_DEBUG, "Process PID %d exited", rc);
120
+
121
+ if (-1 == rc) {
122
+ debug(LOG_ERR, "waitpid() failed (%s)", strerror(errno));
123
+ return 1; /* waitpid failed. */
124
+ }
125
- return (WEXITSTATUS(status));
126
+ if (WIFEXITED(status)) {
127
+ return (WEXITSTATUS(status));
128
+ } else {
129
+ /* If we get here, child did not exit cleanly. Will return non-zero exit code to caller*/
130
+ debug(LOG_DEBUG, "Child may have been killed.");
131
+ return 1;
132
133
}
134
135
struct in_addr *
0 commit comments