summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2003-09-01 02:05:26 +0000
committerColin Watson <cjwatson@debian.org>2003-09-01 02:05:26 +0000
commit6d5a72bc1d98a42ba42f082e50a22e911c1d82d3 (patch)
tree1bf23174bdb6fc71e2846dda0eca195a418484e7 /log.c
parent2ee26b431f98cf1dc0e4fb9809ad1e0c879b8c08 (diff)
parent58657d96514cd6f16d82add8d6f4adbb36765758 (diff)
Debian release 3.5p1-1.
Diffstat (limited to 'log.c')
-rw-r--r--log.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/log.c b/log.c
index be0868fde..12ac11df7 100644
--- a/log.c
+++ b/log.c
@@ -34,7 +34,7 @@
34 */ 34 */
35 35
36#include "includes.h" 36#include "includes.h"
37RCSID("$OpenBSD: log.c,v 1.22 2002/02/22 12:20:34 markus Exp $"); 37RCSID("$OpenBSD: log.c,v 1.24 2002/07/19 15:43:33 markus Exp $");
38 38
39#include "log.h" 39#include "log.h"
40#include "xmalloc.h" 40#include "xmalloc.h"
@@ -93,6 +93,7 @@ SyslogFacility
93log_facility_number(char *name) 93log_facility_number(char *name)
94{ 94{
95 int i; 95 int i;
96
96 if (name != NULL) 97 if (name != NULL)
97 for (i = 0; log_facilities[i].name; i++) 98 for (i = 0; log_facilities[i].name; i++)
98 if (strcasecmp(log_facilities[i].name, name) == 0) 99 if (strcasecmp(log_facilities[i].name, name) == 0)
@@ -104,6 +105,7 @@ LogLevel
104log_level_number(char *name) 105log_level_number(char *name)
105{ 106{
106 int i; 107 int i;
108
107 if (name != NULL) 109 if (name != NULL)
108 for (i = 0; log_levels[i].name; i++) 110 for (i = 0; log_levels[i].name; i++)
109 if (strcasecmp(log_levels[i].name, name) == 0) 111 if (strcasecmp(log_levels[i].name, name) == 0)
@@ -117,6 +119,7 @@ void
117error(const char *fmt,...) 119error(const char *fmt,...)
118{ 120{
119 va_list args; 121 va_list args;
122
120 va_start(args, fmt); 123 va_start(args, fmt);
121 do_log(SYSLOG_LEVEL_ERROR, fmt, args); 124 do_log(SYSLOG_LEVEL_ERROR, fmt, args);
122 va_end(args); 125 va_end(args);
@@ -128,6 +131,7 @@ void
128log(const char *fmt,...) 131log(const char *fmt,...)
129{ 132{
130 va_list args; 133 va_list args;
134
131 va_start(args, fmt); 135 va_start(args, fmt);
132 do_log(SYSLOG_LEVEL_INFO, fmt, args); 136 do_log(SYSLOG_LEVEL_INFO, fmt, args);
133 va_end(args); 137 va_end(args);
@@ -139,6 +143,7 @@ void
139verbose(const char *fmt,...) 143verbose(const char *fmt,...)
140{ 144{
141 va_list args; 145 va_list args;
146
142 va_start(args, fmt); 147 va_start(args, fmt);
143 do_log(SYSLOG_LEVEL_VERBOSE, fmt, args); 148 do_log(SYSLOG_LEVEL_VERBOSE, fmt, args);
144 va_end(args); 149 va_end(args);
@@ -150,6 +155,7 @@ void
150debug(const char *fmt,...) 155debug(const char *fmt,...)
151{ 156{
152 va_list args; 157 va_list args;
158
153 va_start(args, fmt); 159 va_start(args, fmt);
154 do_log(SYSLOG_LEVEL_DEBUG1, fmt, args); 160 do_log(SYSLOG_LEVEL_DEBUG1, fmt, args);
155 va_end(args); 161 va_end(args);
@@ -159,6 +165,7 @@ void
159debug2(const char *fmt,...) 165debug2(const char *fmt,...)
160{ 166{
161 va_list args; 167 va_list args;
168
162 va_start(args, fmt); 169 va_start(args, fmt);
163 do_log(SYSLOG_LEVEL_DEBUG2, fmt, args); 170 do_log(SYSLOG_LEVEL_DEBUG2, fmt, args);
164 va_end(args); 171 va_end(args);
@@ -168,6 +175,7 @@ void
168debug3(const char *fmt,...) 175debug3(const char *fmt,...)
169{ 176{
170 va_list args; 177 va_list args;
178
171 va_start(args, fmt); 179 va_start(args, fmt);
172 do_log(SYSLOG_LEVEL_DEBUG3, fmt, args); 180 do_log(SYSLOG_LEVEL_DEBUG3, fmt, args);
173 va_end(args); 181 va_end(args);
@@ -216,6 +224,18 @@ fatal_remove_cleanup(void (*proc) (void *context), void *context)
216 (u_long) proc, (u_long) context); 224 (u_long) proc, (u_long) context);
217} 225}
218 226
227/* Remove all cleanups, to be called after fork() */
228void
229fatal_remove_all_cleanups(void)
230{
231 struct fatal_cleanup *cu, *next_cu;
232
233 for (cu = fatal_cleanups; cu; cu = next_cu) {
234 next_cu = cu->next;
235 xfree(cu);
236 }
237}
238
219/* Cleanup and exit */ 239/* Cleanup and exit */
220void 240void
221fatal_cleanup(void) 241fatal_cleanup(void)