diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2021-04-19 11:26:23 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2021-04-19 11:26:23 +0000 |
commit | 9969d7437fa6786782e6c780fbadd6561220ccfe (patch) | |
tree | 0be0d73689929500cab25d32695d6074d41c9c90 /src/init | |
parent | eaeee8195f3347b3fa762a7ddbb0c7eb0ef15133 (diff) | |
download | s6-linux-init-9969d7437fa6786782e6c780fbadd6561220ccfe.tar.xz |
Clean up the wtmp mess
Diffstat (limited to 'src/init')
-rw-r--r-- | src/init/s6-linux-init-maker.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/init/s6-linux-init-maker.c b/src/init/s6-linux-init-maker.c index 6d86ff9..c505e04 100644 --- a/src/init/s6-linux-init-maker.c +++ b/src/init/s6-linux-init-maker.c @@ -499,7 +499,7 @@ static inline void auto_basedir (char const *base, char const *dir, uid_t uid, g } } -static int utmpd_script (buffer *b, char const *uw) +static int utmpd_script (buffer *b, char const *aux) { size_t sabase = satmp.len ; if (!put_shebang(b) @@ -512,12 +512,9 @@ static int utmpd_script (buffer *b, char const *uw) if (buffer_puts(b, "\n" EXECLINE_EXTBINPREFIX "cd " S6_LINUX_INIT_TMPFS "/" UTMPS_DIR "\n" EXECLINE_EXTBINPREFIX "fdmove 1 3\n" - S6_EXTBINPREFIX "s6-ipcserver -1 -c 1000 -- ") < 0) return 0 ; - if (buffer_puts(b, uw[0] == 'u' ? UTMPS_UTMPD_PATH : UTMPS_WTMPD_PATH) < 0 - || buffer_puts(b, "\n" - UTMPS_EXTBINPREFIX "utmps-") < 0 - || buffer_puts(b, uw) < 0 - || buffer_puts(b, "tmpd\n") < 0) return 0 ; + S6_EXTBINPREFIX "s6-ipcserver -1 -c 1000 -- " UTMPS_UTMPD_PATH "\n" + UTMPS_EXTBINPREFIX "utmps-utmpd") < 0) return 0 ; + (void)aux ; return 1 ; err: @@ -529,17 +526,13 @@ static inline void make_utmps (char const *base) { auto_dir(base, "run-image/" SCANDIR "/utmpd", 0, 0, 0755) ; auto_file(base, "run-image/" SCANDIR "/utmpd/notification-fd", "3\n", 2) ; - auto_script(base, "run-image/" SCANDIR "/utmpd/run", &utmpd_script, "u") ; - auto_dir(base, "run-image/" SCANDIR "/wtmpd", 0, 0, 0755) ; - auto_file(base, "run-image/" SCANDIR "/wtmpd/notification-fd", "3\n", 2) ; - auto_script(base, "run-image/" SCANDIR "/wtmpd/run", &utmpd_script, "w") ; + auto_script(base, "run-image/" SCANDIR "/utmpd/run", &utmpd_script, 0) ; { uid_t uid ; gid_t gid ; getug(base, utmp_user, &uid, &gid) ; auto_dir(base, "run-image/" UTMPS_DIR, uid, gid, 0755) ; auto_basedir(base, "run-image/" S6_LINUX_INIT_UTMPD_PATH, uid, gid, 0755) ; - auto_basedir(base, "run-image/" S6_LINUX_INIT_WTMPD_PATH, uid, gid, 0755) ; } } |