From 71915e0e1431833ace42aea621cfb0160b4a572c Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Thu, 4 Jan 2018 11:16:58 +0100 Subject: [PATCH] Make sure log_exit() restores progress output on shutdown/reboot This patch builds on top of the recently introduced "silent by default" and support for kernel cmdline `splash` to disable silent operation. At shutdown/reboot `log_exit()` is called, the intention is to re-enable progress output so the user can see what's going on. So, we need to re- set `silent` to the same setting as log_init() started with, hence the new `muffler()`. Signed-off-by: Joachim Nilsson --- src/log.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/log.c b/src/log.c index baacfcf3..d0f8e8f2 100644 --- a/src/log.c +++ b/src/log.c @@ -35,6 +35,15 @@ static int debug = 0; static int silent = SILENT_MODE; /* Completely silent, including boot */ static int loglevel = LOG_NOTICE; +static void muffler(void) +{ + silent = SILENT_MODE; + + /* User override from kernel cmdline */ + if (splash) + silent = 0; +} + void log_init(int dbg) { if (dbg) @@ -45,15 +54,13 @@ void log_init(int dbg) else loglevel = LOG_NOTICE; - /* User override from kernel cmdline */ - if (splash) - silent = 0; + muffler(); } /* If we enabled terse mode at boot, restore to previous setting at shutdown */ void log_exit(void) { - silent = SILENT_MODE; + muffler(); if (!silent) { sched_yield(); fputs("\n", stderr);