Skip to content

Commit 3bb5450

Browse files
thesamesamvapier
authored andcommitted
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.
1 parent a689fdb commit 3bb5450

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/openrc-shutdown/openrc-shutdown.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ int main(int argc, char **argv)
304304
sigaction(SIGINT, &sa, NULL);
305305
sigaction(SIGTERM, &sa, NULL);
306306
while (shutdown_delay > 0) {
307-
need_warning = false;
308307
if (shutdown_delay > 180)
309308
need_warning = (shutdown_delay % 60 == 0);
310309
else if (shutdown_delay > 60)
@@ -313,11 +312,12 @@ int main(int argc, char **argv)
313312
need_warning = (shutdown_delay % 15 == 0);
314313
else
315314
need_warning = true;
315+
316316
if (shutdown_delay <= 5)
317317
create_nologin(shutdown_delay);
318318
if (need_warning) {
319-
xasprintf(&msg, "\rThe system will %s in %d minutes\r\n",
320-
state, shutdown_delay);
319+
xasprintf(&msg, "\rThe system will %s in %d minutes\r\n",
320+
state, shutdown_delay);
321321
broadcast(msg);
322322
free(msg);
323323
}

0 commit comments

Comments
 (0)