diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2015-06-18 23:56:39 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2015-06-18 23:56:39 +0000 |
commit | f737a55e0d6f610f33bd959aef5f54d620ee04c6 (patch) | |
tree | 7e83657b17b26e3bff9dd131020a73a2773c1aeb | |
parent | 4485ae4182ce4d94b5dffe9d334866e3aeae36d3 (diff) | |
download | s6-linux-init-f737a55e0d6f610f33bd959aef5f54d620ee04c6.tar.xz |
Fix finish script to kill s6-svscan-log in order not to be
blocked on it indefinitely.
-rw-r--r-- | src/init/s6-linux-init-maker.c | 15 |
1 files changed, 9 insertions, 6 deletions
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) |