From 551f39fe587758897bf8a283fcb722b34b7211aa Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 2 May 2019 01:00:51 +0000 Subject: Small tweaks --- src/shutdown/s6-linux-init-hpr.c | 2 +- src/shutdown/s6-linux-init-shutdownd.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/shutdown/s6-linux-init-hpr.c b/src/shutdown/s6-linux-init-hpr.c index 886f10b..7e4859a 100644 --- a/src/shutdown/s6-linux-init-hpr.c +++ b/src/shutdown/s6-linux-init-hpr.c @@ -52,7 +52,7 @@ int main (int argc, char const *const *argv) case 'r' : what = 3 ; break ; case 'f' : force = 1 ; break ; case 'd' : dowtmp = 0 ; break ; - case 'w' : dowtmp = 2 ; break ; + case 'w' : dowtmp = 1 ; break ; case 'W' : dowall = 0 ; break ; default : strerr_dieusage(100, USAGE) ; } diff --git a/src/shutdown/s6-linux-init-shutdownd.c b/src/shutdown/s6-linux-init-shutdownd.c index 347d488..130be1a 100644 --- a/src/shutdown/s6-linux-init-shutdownd.c +++ b/src/shutdown/s6-linux-init-shutdownd.c @@ -122,6 +122,7 @@ static inline void prepare_stage4 (char const *basedir, unsigned int what) buffer b ; int fd ; char buf[512] ; + char c = "hpr"[what - 1] ; unlink_void(STAGE4_FILE ".new") ; fd = open_excl(STAGE4_FILE ".new") ; if (fd == -1) strerr_diefu3sys(111, "open ", STAGE4_FILE ".new", " for writing") ; @@ -131,9 +132,9 @@ static inline void prepare_stage4 (char const *basedir, unsigned int what) "#!" EXECLINE_SHEBANGPREFIX "execlineb -P\n\n" EXECLINE_EXTBINPREFIX "foreground { " S6_LINUX_INIT_BINPREFIX "s6-linux-init-umountall }\n" - S6_LINUX_INIT_BINPREFIX "s6-linux-init-hpr -") < 0 - || buffer_put(&b, "hpr" + what - 1, 1) < 0 - || buffer_putsflush(&b, " -f\n") < 0) + S6_LINUX_INIT_BINPREFIX "s6-linux-init-hpr -f -") < 0 + || buffer_put(&b, &c, 1) < 0 + || buffer_putsflush(&b, "\n") < 0) strerr_diefu2sys(111, "write to ", STAGE4_FILE ".new") ; if (fchmod(fd, S_IRWXU) == -1) strerr_diefu2sys(111, "fchmod ", STAGE4_FILE ".new") ; -- cgit v1.2.3