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 <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2018-01-04 11:16:58 +01:00
1 parent 112ab2c22f
commit 71915e0e14
1 file changed
+11 -4
+11 -4
View File
@@ -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);