From 9fa2df49dfe3c9c1bbb77d3ef6fdf2ef9387aea4 Mon Sep 17 00:00:00 2001 From: Hakan Olsson Date: Thu, 26 May 2005 19:18:17 +0000 Subject: check ppid --- usr.sbin/sasyncd/sasyncd.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'usr.sbin/sasyncd') diff --git a/usr.sbin/sasyncd/sasyncd.c b/usr.sbin/sasyncd/sasyncd.c index 0a76273b1b6..d5193fa4b5e 100644 --- a/usr.sbin/sasyncd/sasyncd.c +++ b/usr.sbin/sasyncd/sasyncd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sasyncd.c,v 1.8 2005/05/24 02:35:39 ho Exp $ */ +/* $OpenBSD: sasyncd.c,v 1.9 2005/05/26 19:18:16 ho Exp $ */ /* * Copyright (c) 2005 Håkan Olsson. All rights reserved. @@ -53,7 +53,7 @@ sasyncd_stop(int s) } static int -sasyncd_run(void) +sasyncd_run(pid_t ppid) { struct timeval *timeout, tv; fd_set *rfds, *wfds; @@ -108,6 +108,12 @@ sasyncd_run(void) pfkey_send_message(wfds); } timer_run(); + + /* Mostly for debugging. */ + if (getppid() != ppid) { + log_msg(0, "sasyncd: parent died"); + daemon_shutdown++; + } } free(rfds); free(wfds); @@ -168,7 +174,7 @@ main(int argc, char **argv) } /* Child, no privileges left. Run main loop. */ - sasyncd_run(); + sasyncd_run(getppid()); /* Shutdown. */ log_msg(0, "shutting down..."); -- cgit v1.2.3