From f737a55e0d6f610f33bd959aef5f54d620ee04c6 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 18 Jun 2015 23:56:39 +0000 Subject: Fix finish script to kill s6-svscan-log in order not to be blocked on it indefinitely. --- src/init/s6-linux-init-maker.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/init') diff --git a/src/init/s6-linux-init-maker.c b/src/init/s6-linux-init-maker.c index d603a86..cc8ca57 100644 --- a/src/init/s6-linux-init-maker.c +++ b/src/init/s6-linux-init-maker.c @@ -102,16 +102,19 @@ static int finish_script (buffer *b) if (buffer_puts(b, "#!") < 0 || buffer_puts(b, bindir) < 0 || buffer_puts(b, "/execlineb -S0\n\n" - "cd /\nredirfd -w 2 /dev/console\nfdmove -c 1 2\nwait { }\n") < 0 + "cd /\nredirfd -w 2 /dev/console\nfdmove -c 1 2\nif { s6-svc -xh -- ") < 0 + || !string_quote(&satmp, slashrun, str_len(slashrun))) return 0 ; + if (buffer_put(b, satmp.s + sabase, satmp.len - sabase) < 0) goto err ; + satmp.len = sabase ; + if (buffer_puts(b, "/service/s6-svscan-log }\nwait { }\n") < 0 || !string_quote(&satmp, shutdown_script, str_len(shutdown_script))) return 0 ; - if (buffer_put(b, satmp.s + sabase, satmp.len - sabase) < 0) - { - satmp.len = sabase ; - return 0 ; - } + if (buffer_put(b, satmp.s + sabase, satmp.len - sabase) < 0) goto err ; satmp.len = sabase ; if (buffer_puts(b, " ${@}\n") < 0) return 0 ; return 1 ; + err: + satmp.len = sabase ; + return 0 ; } static void cleanup (char const *base) -- cgit v1.2.3