diff options
author | Colin Watson <cjwatson@debian.org> | 2017-10-04 11:23:58 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2017-10-05 23:58:12 +0100 |
commit | 0556ea972b15607b7e13ff31bc05840881c91dd3 (patch) | |
tree | d6b8d48062d0278b5ae0eeff42d0e9afa9f26860 /log.c | |
parent | db2122d97eb1ecdd8d99b7bf79b0dd2b5addfd92 (diff) | |
parent | 801a62eedaaf47b20dbf4b426dc3e084bf0c8d49 (diff) |
New upstream release (7.6p1)
Diffstat (limited to 'log.c')
-rw-r--r-- | log.c | 35 |
1 files changed, 19 insertions, 16 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: log.c,v 1.49 2017/03/10 03:15:58 djm Exp $ */ | 1 | /* $OpenBSD: log.c,v 1.50 2017/05/17 01:24:17 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -257,18 +257,7 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) | |||
257 | 257 | ||
258 | argv0 = av0; | 258 | argv0 = av0; |
259 | 259 | ||
260 | switch (level) { | 260 | if (log_change_level(level) != 0) { |
261 | case SYSLOG_LEVEL_QUIET: | ||
262 | case SYSLOG_LEVEL_FATAL: | ||
263 | case SYSLOG_LEVEL_ERROR: | ||
264 | case SYSLOG_LEVEL_INFO: | ||
265 | case SYSLOG_LEVEL_VERBOSE: | ||
266 | case SYSLOG_LEVEL_DEBUG1: | ||
267 | case SYSLOG_LEVEL_DEBUG2: | ||
268 | case SYSLOG_LEVEL_DEBUG3: | ||
269 | log_level = level; | ||
270 | break; | ||
271 | default: | ||
272 | fprintf(stderr, "Unrecognized internal syslog level code %d\n", | 261 | fprintf(stderr, "Unrecognized internal syslog level code %d\n", |
273 | (int) level); | 262 | (int) level); |
274 | exit(1); | 263 | exit(1); |
@@ -341,13 +330,27 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) | |||
341 | #endif | 330 | #endif |
342 | } | 331 | } |
343 | 332 | ||
344 | void | 333 | int |
345 | log_change_level(LogLevel new_log_level) | 334 | log_change_level(LogLevel new_log_level) |
346 | { | 335 | { |
347 | /* no-op if log_init has not been called */ | 336 | /* no-op if log_init has not been called */ |
348 | if (argv0 == NULL) | 337 | if (argv0 == NULL) |
349 | return; | 338 | return 0; |
350 | log_init(argv0, new_log_level, log_facility, log_on_stderr); | 339 | |
340 | switch (new_log_level) { | ||
341 | case SYSLOG_LEVEL_QUIET: | ||
342 | case SYSLOG_LEVEL_FATAL: | ||
343 | case SYSLOG_LEVEL_ERROR: | ||
344 | case SYSLOG_LEVEL_INFO: | ||
345 | case SYSLOG_LEVEL_VERBOSE: | ||
346 | case SYSLOG_LEVEL_DEBUG1: | ||
347 | case SYSLOG_LEVEL_DEBUG2: | ||
348 | case SYSLOG_LEVEL_DEBUG3: | ||
349 | log_level = new_log_level; | ||
350 | return 0; | ||
351 | default: | ||
352 | return -1; | ||
353 | } | ||
351 | } | 354 | } |
352 | 355 | ||
353 | int | 356 | int |