summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2017-10-04 11:23:58 +0100
committerColin Watson <cjwatson@debian.org>2017-10-05 23:58:12 +0100
commit0556ea972b15607b7e13ff31bc05840881c91dd3 (patch)
treed6b8d48062d0278b5ae0eeff42d0e9afa9f26860 /log.c
parentdb2122d97eb1ecdd8d99b7bf79b0dd2b5addfd92 (diff)
parent801a62eedaaf47b20dbf4b426dc3e084bf0c8d49 (diff)
New upstream release (7.6p1)
Diffstat (limited to 'log.c')
-rw-r--r--log.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/log.c b/log.c
index 0e515e26d..1559091da 100644
--- a/log.c
+++ b/log.c
@@ -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
344void 333int
345log_change_level(LogLevel new_log_level) 334log_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
353int 356int