From 3bb5450320afc903ce73563db2c7341d97b68cbe Mon Sep 17 00:00:00 2001 From: Sam James Date: Wed, 25 Jan 2023 04:09:39 +0000 Subject: [PATCH] openrc-shutdown: fix need_warning dead store It's already initialised to false at the start and it's clear when reading what the flow is. While at it, fix some indentation and adjust whitespace to make more readable. --- src/openrc-shutdown/openrc-shutdown.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openrc-shutdown/openrc-shutdown.c b/src/openrc-shutdown/openrc-shutdown.c index 6255a485..dddc749b 100644 --- a/src/openrc-shutdown/openrc-shutdown.c +++ b/src/openrc-shutdown/openrc-shutdown.c @@ -304,7 +304,6 @@ int main(int argc, char **argv) sigaction(SIGINT, &sa, NULL); sigaction(SIGTERM, &sa, NULL); while (shutdown_delay > 0) { - need_warning = false; if (shutdown_delay > 180) need_warning = (shutdown_delay % 60 == 0); else if (shutdown_delay > 60) @@ -313,11 +312,12 @@ int main(int argc, char **argv) need_warning = (shutdown_delay % 15 == 0); else need_warning = true; + if (shutdown_delay <= 5) create_nologin(shutdown_delay); if (need_warning) { - xasprintf(&msg, "\rThe system will %s in %d minutes\r\n", - state, shutdown_delay); + xasprintf(&msg, "\rThe system will %s in %d minutes\r\n", + state, shutdown_delay); broadcast(msg); free(msg); }