summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/log.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2004-02-26 10:38:49 +0000
committerdes <des@FreeBSD.org>2004-02-26 10:38:49 +0000
commit7d1750f1d6c24163bf22790f8527f1783315c5e7 (patch)
tree44704f8b727acba451fd902fe3c26053cb6ce73e /crypto/openssh/log.c
parent5c8d98dfbd6964b6be84da30b9d16df0cab3c42d (diff)
downloadFreeBSD-src-7d1750f1d6c24163bf22790f8527f1783315c5e7.zip
FreeBSD-src-7d1750f1d6c24163bf22790f8527f1783315c5e7.tar.gz
Vendor import of OpenSSH 3.8p1.
Diffstat (limited to 'crypto/openssh/log.c')
-rw-r--r--crypto/openssh/log.c83
1 files changed, 3 insertions, 80 deletions
diff --git a/crypto/openssh/log.c b/crypto/openssh/log.c
index 9bce255..0c4d512 100644
--- a/crypto/openssh/log.c
+++ b/crypto/openssh/log.c
@@ -34,7 +34,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: log.c,v 1.28 2003/05/24 09:02:22 djm Exp $");
+RCSID("$OpenBSD: log.c,v 1.29 2003/09/23 20:17:11 markus Exp $");
#include "log.h"
#include "xmalloc.h"
@@ -183,83 +183,6 @@ debug3(const char *fmt,...)
va_end(args);
}
-/* Fatal cleanup */
-
-struct fatal_cleanup {
- struct fatal_cleanup *next;
- void (*proc) (void *);
- void *context;
-};
-
-static struct fatal_cleanup *fatal_cleanups = NULL;
-
-/* Registers a cleanup function to be called by fatal() before exiting. */
-
-void
-fatal_add_cleanup(void (*proc) (void *), void *context)
-{
- struct fatal_cleanup *cu;
-
- cu = xmalloc(sizeof(*cu));
- cu->proc = proc;
- cu->context = context;
- cu->next = fatal_cleanups;
- fatal_cleanups = cu;
-}
-
-/* Removes a cleanup frunction to be called at fatal(). */
-
-void
-fatal_remove_cleanup(void (*proc) (void *context), void *context)
-{
- struct fatal_cleanup **cup, *cu;
-
- for (cup = &fatal_cleanups; *cup; cup = &cu->next) {
- cu = *cup;
- if (cu->proc == proc && cu->context == context) {
- *cup = cu->next;
- xfree(cu);
- return;
- }
- }
- fatal("fatal_remove_cleanup: no such cleanup function: 0x%lx 0x%lx",
- (u_long) proc, (u_long) context);
-}
-
-/* Remove all cleanups, to be called after fork() */
-void
-fatal_remove_all_cleanups(void)
-{
- struct fatal_cleanup *cu, *next_cu;
-
- for (cu = fatal_cleanups; cu; cu = next_cu) {
- next_cu = cu->next;
- xfree(cu);
- }
- fatal_cleanups = NULL;
-}
-
-/* Cleanup and exit */
-void
-fatal_cleanup(void)
-{
- struct fatal_cleanup *cu, *next_cu;
- static int called = 0;
-
- if (called)
- exit(255);
- called = 1;
- /* Call cleanup functions. */
- for (cu = fatal_cleanups; cu; cu = next_cu) {
- next_cu = cu->next;
- debug("Calling cleanup 0x%lx(0x%lx)",
- (u_long) cu->proc, (u_long) cu->context);
- (*cu->proc) (cu->context);
- }
- exit(255);
-}
-
-
/*
* Initialize the log.
*/
@@ -342,7 +265,7 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr)
void
do_log(LogLevel level, const char *fmt, va_list args)
{
-#ifdef OPENLOG_R
+#if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT)
struct syslog_data sdata = SYSLOG_DATA_INIT;
#endif
char msgbuf[MSGBUFSIZ];
@@ -398,7 +321,7 @@ do_log(LogLevel level, const char *fmt, va_list args)
snprintf(msgbuf, sizeof msgbuf, "%s\r\n", fmtbuf);
write(STDERR_FILENO, msgbuf, strlen(msgbuf));
} else {
-#ifdef OPENLOG_R
+#if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT)
openlog_r(argv0 ? argv0 : __progname, LOG_PID, log_facility, &sdata);
syslog_r(pri, &sdata, "%.500s", fmtbuf);
closelog_r(&sdata);
OpenPOWER on IntegriCloud