diff options
Diffstat (limited to 'log.c')
-rw-r--r-- | log.c | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -34,7 +34,7 @@ | |||
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include "includes.h" | 36 | #include "includes.h" |
37 | RCSID("$OpenBSD: log.c,v 1.22 2002/02/22 12:20:34 markus Exp $"); | 37 | RCSID("$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" |
@@ -92,6 +92,7 @@ SyslogFacility | |||
92 | log_facility_number(char *name) | 92 | log_facility_number(char *name) |
93 | { | 93 | { |
94 | int i; | 94 | int i; |
95 | |||
95 | if (name != NULL) | 96 | if (name != NULL) |
96 | for (i = 0; log_facilities[i].name; i++) | 97 | for (i = 0; log_facilities[i].name; i++) |
97 | if (strcasecmp(log_facilities[i].name, name) == 0) | 98 | if (strcasecmp(log_facilities[i].name, name) == 0) |
@@ -103,6 +104,7 @@ LogLevel | |||
103 | log_level_number(char *name) | 104 | log_level_number(char *name) |
104 | { | 105 | { |
105 | int i; | 106 | int i; |
107 | |||
106 | if (name != NULL) | 108 | if (name != NULL) |
107 | for (i = 0; log_levels[i].name; i++) | 109 | for (i = 0; log_levels[i].name; i++) |
108 | if (strcasecmp(log_levels[i].name, name) == 0) | 110 | if (strcasecmp(log_levels[i].name, name) == 0) |
@@ -116,6 +118,7 @@ void | |||
116 | error(const char *fmt,...) | 118 | error(const char *fmt,...) |
117 | { | 119 | { |
118 | va_list args; | 120 | va_list args; |
121 | |||
119 | va_start(args, fmt); | 122 | va_start(args, fmt); |
120 | do_log(SYSLOG_LEVEL_ERROR, fmt, args); | 123 | do_log(SYSLOG_LEVEL_ERROR, fmt, args); |
121 | va_end(args); | 124 | va_end(args); |
@@ -127,6 +130,7 @@ void | |||
127 | log(const char *fmt,...) | 130 | log(const char *fmt,...) |
128 | { | 131 | { |
129 | va_list args; | 132 | va_list args; |
133 | |||
130 | va_start(args, fmt); | 134 | va_start(args, fmt); |
131 | do_log(SYSLOG_LEVEL_INFO, fmt, args); | 135 | do_log(SYSLOG_LEVEL_INFO, fmt, args); |
132 | va_end(args); | 136 | va_end(args); |
@@ -138,6 +142,7 @@ void | |||
138 | verbose(const char *fmt,...) | 142 | verbose(const char *fmt,...) |
139 | { | 143 | { |
140 | va_list args; | 144 | va_list args; |
145 | |||
141 | va_start(args, fmt); | 146 | va_start(args, fmt); |
142 | do_log(SYSLOG_LEVEL_VERBOSE, fmt, args); | 147 | do_log(SYSLOG_LEVEL_VERBOSE, fmt, args); |
143 | va_end(args); | 148 | va_end(args); |
@@ -149,6 +154,7 @@ void | |||
149 | debug(const char *fmt,...) | 154 | debug(const char *fmt,...) |
150 | { | 155 | { |
151 | va_list args; | 156 | va_list args; |
157 | |||
152 | va_start(args, fmt); | 158 | va_start(args, fmt); |
153 | do_log(SYSLOG_LEVEL_DEBUG1, fmt, args); | 159 | do_log(SYSLOG_LEVEL_DEBUG1, fmt, args); |
154 | va_end(args); | 160 | va_end(args); |
@@ -158,6 +164,7 @@ void | |||
158 | debug2(const char *fmt,...) | 164 | debug2(const char *fmt,...) |
159 | { | 165 | { |
160 | va_list args; | 166 | va_list args; |
167 | |||
161 | va_start(args, fmt); | 168 | va_start(args, fmt); |
162 | do_log(SYSLOG_LEVEL_DEBUG2, fmt, args); | 169 | do_log(SYSLOG_LEVEL_DEBUG2, fmt, args); |
163 | va_end(args); | 170 | va_end(args); |
@@ -167,6 +174,7 @@ void | |||
167 | debug3(const char *fmt,...) | 174 | debug3(const char *fmt,...) |
168 | { | 175 | { |
169 | va_list args; | 176 | va_list args; |
177 | |||
170 | va_start(args, fmt); | 178 | va_start(args, fmt); |
171 | do_log(SYSLOG_LEVEL_DEBUG3, fmt, args); | 179 | do_log(SYSLOG_LEVEL_DEBUG3, fmt, args); |
172 | va_end(args); | 180 | va_end(args); |
@@ -215,6 +223,18 @@ fatal_remove_cleanup(void (*proc) (void *context), void *context) | |||
215 | (u_long) proc, (u_long) context); | 223 | (u_long) proc, (u_long) context); |
216 | } | 224 | } |
217 | 225 | ||
226 | /* Remove all cleanups, to be called after fork() */ | ||
227 | void | ||
228 | fatal_remove_all_cleanups(void) | ||
229 | { | ||
230 | struct fatal_cleanup *cu, *next_cu; | ||
231 | |||
232 | for (cu = fatal_cleanups; cu; cu = next_cu) { | ||
233 | next_cu = cu->next; | ||
234 | xfree(cu); | ||
235 | } | ||
236 | } | ||
237 | |||
218 | /* Cleanup and exit */ | 238 | /* Cleanup and exit */ |
219 | void | 239 | void |
220 | fatal_cleanup(void) | 240 | fatal_cleanup(void) |