summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2002-08-08 18:17:50 +0000
committermillert <millert@openbsd.org>2002-08-08 18:17:50 +0000
commitd8a3077212ce2cf166b08fb6850813d67c8bd0a1 (patch)
tree7dfa6fe8b3c056e344ee7ad77665833bd7fa596d
parentMake wakeupKind an enum for clarity at Vixie's request (diff)
downloadwireguard-openbsd-d8a3077212ce2cf166b08fb6850813d67c8bd0a1.tar.xz
wireguard-openbsd-d8a3077212ce2cf166b08fb6850813d67c8bd0a1.zip
Move closelog() into log_close() function and call that instead
of calling closelog() (with #ifdefs) directly.
-rw-r--r--usr.sbin/cron/atrun.c9
-rw-r--r--usr.sbin/cron/do_command.c8
-rw-r--r--usr.sbin/cron/misc.c16
3 files changed, 17 insertions, 16 deletions
diff --git a/usr.sbin/cron/atrun.c b/usr.sbin/cron/atrun.c
index 2129e3d14e9..c3043c3c85a 100644
--- a/usr.sbin/cron/atrun.c
+++ b/usr.sbin/cron/atrun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atrun.c,v 1.3 2002/08/07 23:22:41 millert Exp $ */
+/* $OpenBSD: atrun.c,v 1.4 2002/08/08 18:17:50 millert Exp $ */
/*
* Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -28,7 +28,7 @@
*/
#if !defined(lint) && !defined(LINT)
-static const char rcsid[] = "$OpenBSD: atrun.c,v 1.3 2002/08/07 23:22:41 millert Exp $";
+static const char rcsid[] = "$OpenBSD: atrun.c,v 1.4 2002/08/08 18:17:50 millert Exp $";
#endif
#include "cron.h"
@@ -401,9 +401,8 @@ run_job(atjob *job, char *atfile)
/* Write log message now that we have our real pid. */
log_it(pw->pw_name, getpid(), "ATJOB", atfile);
-#ifdef SYSLOG
- closelog();
-#endif
+ /* Close log file (or syslog) */
+ log_close();
/* Connect grandchild's stdin to the at job file. */
if (lseek(fd, (off_t) 0, SEEK_SET) < 0) {
diff --git a/usr.sbin/cron/do_command.c b/usr.sbin/cron/do_command.c
index e575641b49b..6eb2c5388a2 100644
--- a/usr.sbin/cron/do_command.c
+++ b/usr.sbin/cron/do_command.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: do_command.c,v 1.21 2002/07/15 22:38:36 millert Exp $ */
+/* $OpenBSD: do_command.c,v 1.22 2002/08/08 18:17:50 millert Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* All rights reserved
*/
@@ -21,7 +21,7 @@
*/
#if !defined(lint) && !defined(LINT)
-static char const rcsid[] = "$OpenBSD: do_command.c,v 1.21 2002/07/15 22:38:36 millert Exp $";
+static char const rcsid[] = "$OpenBSD: do_command.c,v 1.22 2002/08/08 18:17:50 millert Exp $";
#endif
#include "cron.h"
@@ -160,9 +160,7 @@ child_process(entry *e, user *u) {
/* that's the last thing we'll log. close the log files.
*/
-#ifdef SYSLOG
- closelog();
-#endif
+ log_close();
/* get new pgrp, void tty, etc.
*/
diff --git a/usr.sbin/cron/misc.c b/usr.sbin/cron/misc.c
index 4c2a38eada0..1fbbc70e047 100644
--- a/usr.sbin/cron/misc.c
+++ b/usr.sbin/cron/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.22 2002/07/15 19:13:29 millert Exp $ */
+/* $OpenBSD: misc.c,v 1.23 2002/08/08 18:17:50 millert Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* All rights reserved
*/
@@ -21,7 +21,7 @@
*/
#if !defined(lint) && !defined(LINT)
-static char const rcsid[] = "$OpenBSD: misc.c,v 1.22 2002/07/15 19:13:29 millert Exp $";
+static char const rcsid[] = "$OpenBSD: misc.c,v 1.23 2002/08/08 18:17:50 millert Exp $";
#endif
/* vix 26jan87 [RCS has the rest of the log]
@@ -46,6 +46,10 @@ static char const rcsid[] = "$OpenBSD: misc.c,v 1.22 2002/07/15 19:13:29 millert
static int LogFD = ERR;
+#if defined(SYSLOG)
+static int syslog_open = FALSE;
+#endif
+
/*
* glue_strings is the overflow-safe equivalent of
* sprintf(buffer, "%s%c%s", a, separator, b);
@@ -486,10 +490,6 @@ log_it(const char *username, PID_T xpid, const char *event, const char *detail)
struct tm *t = localtime(&now);
#endif /*LOG_FILE*/
-#if defined(SYSLOG)
- static int syslog_open = 0;
-#endif
-
#if defined(LOG_FILE)
/* we assume that MAX_TEMPSTR will hold the date, time, &punctuation.
*/
@@ -558,6 +558,10 @@ log_close(void) {
close(LogFD);
LogFD = ERR;
}
+#if defined(SYSLOG)
+ closelog();
+ syslog_open = FALSE;
+#endif /*SYSLOG*/
}
/* char *first_word(char *s, char *t)