diff options
author | Sam James <sam@gentoo.org> | 2023-01-25 04:09:39 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2023-01-25 00:07:03 -0500 |
commit | 3bb5450320afc903ce73563db2c7341d97b68cbe (patch) | |
tree | 51cee4b389df764689a7c4877913e7b9193d5095 /src | |
parent | a689fdb7beccccbbe448d262993489f0f1c7a825 (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/openrc-shutdown/openrc-shutdown.c | 6 |
1 files 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); } |