ok?
When isakmpd's main process dies abnormally, currently its "monitor"
process exits with status 0. Fix it to use the exit status of main
process.
Index: sbin/isakmpd/monitor.c
===================================================================
RCS file: /var/cvs/openbsd/src/sbin/isakmpd/monitor.c,v
retrieving revision 1.80
diff -u -p -r1.80 monitor.c
--- sbin/isakmpd/monitor.c 19 Dec 2019 19:09:53 -0000 1.80
+++ sbin/isakmpd/monitor.c 23 Jan 2020 03:54:35 -0000
@@ -146,7 +146,7 @@ monitor_init(int debug)
void
monitor_exit(int code)
{
- int status;
+ int status = 0, gotstatus = 0;
pid_t pid;
if (m_state.pid != 0) {
@@ -156,6 +156,8 @@ monitor_exit(int code)
do {
pid = waitpid(m_state.pid, &status, 0);
} while (pid == -1 && errno == EINTR);
+ if (pid != -1)
+ gotstatus = 1;
/* Remove FIFO and pid files. */
unlink(ui_fifo);
@@ -163,7 +165,10 @@ monitor_exit(int code)
}
close(m_state.s);
- exit(code);
+ if (code == 0 && gotstatus)
+ exit(WIFEXITED(status)? WEXITSTATUS(status) : 1);
+ else
+ exit(code);
}
int