diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-04-28 23:48:26 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-04-28 23:48:26 +0000 |
commit | 26f83a95417ff2e5866d6fefab4d737509761622 (patch) | |
tree | 004320a4e34db14876925580a77a972a69bd6fde /src | |
parent | e5512f97985e8ce0798437750fa635dd1c3b02d9 (diff) | |
download | s6-linux-init-26f83a95417ff2e5866d6fefab4d737509761622.tar.xz |
More bugfixes, glibc multilib workaround
Diffstat (limited to 'src')
-rw-r--r-- | src/init/s6-linux-init-maker.c | 28 | ||||
-rw-r--r-- | src/init/s6-linux-init.c | 4 | ||||
-rw-r--r-- | src/shutdown/s6-linux-init-hpr.c | 13 |
3 files changed, 29 insertions, 16 deletions
diff --git a/src/init/s6-linux-init-maker.c b/src/init/s6-linux-init-maker.c index 13f1a7f..1326583 100644 --- a/src/init/s6-linux-init-maker.c +++ b/src/init/s6-linux-init-maker.c @@ -45,7 +45,7 @@ static char const *robase = BASEDIR ; static char const *initial_path = INITPATH ; static char const *env_store = 0 ; static char const *early_getty = 0 ; -static char const *slashdev = 0 ; +static char const *slashdev = "2" ; static char const *log_user = "root" ; static char const *initdefault = 0 ; static unsigned int initial_umask = 0022 ; @@ -121,13 +121,7 @@ static int s6_svscan_log_script (buffer *b, char const *data) if (buffer_put(b, satmp.s + sabase, satmp.len - sabase) < 0) goto err ; satmp.len = sabase ; if (buffer_puts(b, "\ns6-log -bpd3 -- ") < 0) return 0 ; - if (console) - { - if (timestamp_style & 1 && buffer_puts(b, "t ") < 0 - || timestamp_style & 2 && buffer_puts(b, "T ") < 0 - || buffer_puts(b, "1 ") < 0) - return 0 ; - } + if (console && buffer_puts(b, "1 ") < 0) return 0 ; if (timestamp_style & 1 && buffer_puts(b, "t ") < 0 || timestamp_style & 2 && buffer_puts(b, "T ") < 0 || buffer_puts(b, S6_LINUX_INIT_TMPFS "/" UNCAUGHT_DIR "\n") < 0) @@ -593,14 +587,20 @@ int main (int argc, char const *const *argv, char const *const *envp) if (robase[0] != '/') strerr_dief3x(100, "base directory ", robase, " is not absolute") ; - if (slashdev && slashdev[0] != '/') - strerr_dief3x(100, "devtmpfs mounting location ", slashdev, " is not absolute") ; - if (env_store[0] != '/') - strerr_dief3x(100, "kernel environment storage directory ", env_store, " is not absolute") ; + if (env_store) + { + if (env_store[0] != '/') + strerr_dief3x(100, "kernel environment store ", env_store, " is not absolute") ; + if (!str_start(env_store, S6_LINUX_INIT_TMPFS "/")) + strerr_warnw3x("kernel environment store ", env_store, " is not located under initial tmpfs " S6_LINUX_INIT_TMPFS) ; + } if (timestamp_style > 3) strerr_dief1x(100, "-t timestamp_style must be 0, 1, 2 or 3") ; - if (env_store && !str_start(env_store, S6_LINUX_INIT_TMPFS "/")) - strerr_warnw3x("declared environment store ", env_store, " is not located under initial tmpfs " S6_LINUX_INIT_TMPFS) ; + { + unsigned int u ; + if (!uint0_scan(slashdev, &u) || u > 2) + strerr_dief1x(100, "-d dev_style must be 0, 1 or 2") ; + } umask(0) ; if (mkdir(argv[0], 0755) < 0) diff --git a/src/init/s6-linux-init.c b/src/init/s6-linux-init.c index b589ec3..b6113a9 100644 --- a/src/init/s6-linux-init.c +++ b/src/init/s6-linux-init.c @@ -47,7 +47,7 @@ static inline void run_stage2 (char const *basedir, char const **argv, unsigned memcpy(fn, basedir, dirlen) ; memcpy(fn + dirlen, "/scripts/" STAGE2, sizeof("/scripts/" STAGE2)) ; childargv[0] = fn ; - childargv[1] = scan_cmdline(initdefault, argv + 1, argc - 1) ; + childargv[1] = scan_cmdline(initdefault, argv, argc) ; for (unsigned int i = 0 ; i < argc ; i++) childargv[i+2] = argv[i] ; childargv[argc + 2] = 0 ; @@ -73,7 +73,7 @@ int main (int argc, char const **argv, char const *const *envp) if (getpid() != 1) { - argv[0] = S6_LINUX_INIT_BINPREFIX "/s6-linux-init-telinit" ; + argv[0] = S6_LINUX_INIT_BINPREFIX "s6-linux-init-telinit" ; pathexec_run(argv[0], argv, envp) ; strerr_dieexec(111, argv[0]) ; } diff --git a/src/shutdown/s6-linux-init-hpr.c b/src/shutdown/s6-linux-init-hpr.c index c5f7afb..886f10b 100644 --- a/src/shutdown/s6-linux-init-hpr.c +++ b/src/shutdown/s6-linux-init-hpr.c @@ -93,8 +93,21 @@ int main (int argc, char const *const *argv) strerr_warnwu1sys("gethostname") ; } else utx.ut_host[UT_HOSTSIZE - 1] = 0 ; + +/* glibc multilib can go fuck itself */ +#ifdef __WORDSIZE_TIME64_COMPAT32 + { + struct timeval tv ; + if (!timeval_from_tain(&tv, &STAMP)) + strerr_warnwu1sys("timeval_from_tain") ; + utx.ut_tv.tv_sec = tv.tv_sec ; + utx.ut_tv.tv_usec = tv.tv_usec ; + } +#else if (!timeval_from_tain(&utx.ut_tv, &STAMP)) strerr_warnwu1sys("timeval_from_tain") ; +#endif + updwtmpx(_PATH_WTMP, &utx) ; } if (dowall) hpr_wall(HPR_WALL_BANNER) ; |