[systemd-devel] [PATCH] shutdown: pass own argv to /run/initramfs/shutdown

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Mon Sep 29 20:03:52 PDT 2014


On Fri, Aug 29, 2014 at 05:51:45PM +0200, Marius Tessmann wrote:
> Since commit b1e90ec515408aec2702522f6f68c4920b56375b systemd passes
> its log settings to systemd-shutdown via command line parameters.
> However, systemd-shutdown doesn't pass these parameters to
> /run/initramfs/shutdown, causing it to fall back to the default log
> settings.
Hi,
sorry for the late reply.

Your patch should work fine if /run/initramfs/shutdown accepts
those arguments, i.e. if it another systemd binary. But otherwise
it might fail, no?

Zbyszek

> This fixes the following bugs about the shutdown not being quiet
> despite "quiet" being in the kernel parameters:
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=79582
> https://bugs.freedesktop.org/show_bug.cgi?id=57216
> ---
>  src/core/shutdown.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/core/shutdown.c b/src/core/shutdown.c
> index 1e88b05..d361cbe 100644
> --- a/src/core/shutdown.c
> +++ b/src/core/shutdown.c
> @@ -313,7 +313,7 @@ int main(int argc, char *argv[]) {
>              access("/run/initramfs/shutdown", X_OK) == 0) {
>                  r = switch_root_initramfs();
>                  if (r >= 0) {
> -                        arguments[0] = (char*) "/shutdown";
> +                        argv[0] = (char*) "/shutdown";
>  
>                          setsid();
>                          make_console_stdio();
> @@ -321,7 +321,7 @@ int main(int argc, char *argv[]) {
>                          log_info("Successfully changed into root pivot.\n"
>                                   "Returning to initrd...");
>  
> -                        execv("/shutdown", arguments);
> +                        execv("/shutdown", argv);
>                          log_error("Failed to execute shutdown binary: %m");
>                  } else
>                          log_error("Failed to switch root to \"/run/initramfs\": %s", strerror(-r));
> -- 
> 2.1.0
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 


More information about the systemd-devel mailing list