On Thu, Nov 07, 2024 at 10:59:12PM +0000, Andrew Bower wrote: [...] > I attach a patch which ignores the -P and -H options and any provided > shutdown message so that the default ACPI power button handler provided > by acpi-support-base works. [...]
Corrected version (v2) of this patch attached, rebased to 'next' branch on salsa.
From 5968e46d591e3df073611775e30fa8e1af0dfdb6 Mon Sep 17 00:00:00 2001 From: Andrew Bower <and...@bower.uk> Date: Thu, 7 Nov 2024 23:12:49 +0000 Subject: [PATCH] accept but ignore shutdown -H, -P and message arguments Allows default power button handler from acpi-support-base to work. Closes: #1087001 --- debian/contrib/shutdown.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/debian/contrib/shutdown.c b/debian/contrib/shutdown.c index 6cd3060..01706de 100644 --- a/debian/contrib/shutdown.c +++ b/debian/contrib/shutdown.c @@ -164,6 +164,7 @@ int open_trunc(const char *fn) static void parse_command_line(struct config *cfg, int argc, char **argv) { + int options_ended = 0; int i; cfg->action = ACTION_HALT; @@ -197,22 +198,30 @@ parse_command_line(struct config *cfg, int argc, char **argv) cfg->dofsck = true; continue; } + if (strcmp(argv[i], "-P") == 0 || + strcmp(argv[i], "-H") == 0) { + /* Halt actions not distinguished */ + continue; + } if (argv[i][0] == '-') { write2(SUSAGE); cfg->error = true; break; } if (strcmp(argv[i], "now") == 0) { + options_ended = 1; /*write1("time argument ignored\n"); */ continue; } - else { - /* time spec and shutdown message not supported */ + else if (!options_ended) { + /* time spec not supported */ write1("time argument: not supported\n"); - write1("shutdown message: not supported\n"); write2(SUSAGE); cfg->error = true; break; + } else { + write1("shutdown message: ignored\n"); + break; } } else { -- 2.45.2
signature.asc
Description: PGP signature