From c4c4dc76753a5e94426d15536edeba5c7714a6dc Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Mon, 5 Nov 2001 09:58:14 +0000 Subject: some syslog_r uses in signal handlers --- sbin/mount_portal/mount_portal.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'sbin/mount_portal/mount_portal.c') diff --git a/sbin/mount_portal/mount_portal.c b/sbin/mount_portal/mount_portal.c index 9f460777094..d3ea7a53dfa 100644 --- a/sbin/mount_portal/mount_portal.c +++ b/sbin/mount_portal/mount_portal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mount_portal.c,v 1.14 2001/01/19 17:57:39 deraadt Exp $ */ +/* $OpenBSD: mount_portal.c,v 1.15 2001/11/05 09:58:13 deraadt Exp $ */ /* $NetBSD: mount_portal.c,v 1.8 1996/04/13 01:31:54 jtc Exp $ */ /* @@ -47,7 +47,7 @@ char copyright[] = #if 0 static char sccsid[] = "@(#)mount_portal.c 8.6 (Berkeley) 4/26/95"; #else -static char rcsid[] = "$OpenBSD: mount_portal.c,v 1.14 2001/01/19 17:57:39 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: mount_portal.c,v 1.15 2001/11/05 09:58:13 deraadt Exp $"; #endif #endif /* not lint */ @@ -88,12 +88,13 @@ sigchld(sig) int sig; { int save_errno = errno; + struct syslog_data sdata = SYSLOG_DATA_INIT; pid_t pid; while ((pid = waitpid((pid_t) -1, NULL, WNOHANG)) > 0) ; if (pid < 0 && errno != ECHILD) - syslog(LOG_WARNING, "waitpid: %m"); /* XXX signal race */ + syslog_r(LOG_WARNING, &sdata, "waitpid: %m"); errno = save_errno; } @@ -109,10 +110,12 @@ static void sigterm(sig) int sig; { - /* XXX signal races */ + struct syslog_data sdata = SYSLOG_DATA_INIT; + if (unmount(mountpt, MNT_FORCE) < 0) - syslog(LOG_WARNING, "sigterm: unmounting %s failed: %m", - mountpt); + syslog_r(LOG_WARNING, &sdata, + "sigterm: unmounting %s failed: %m", mountpt); + _exit(1); } int -- cgit v1.2.3