From 75d6cad031eecd4b39ad0e000586666419e87865 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 12 May 2019 23:02:05 +0000 Subject: No utmpx errors; no additional /dev/console message when shutdown -a fails --- src/shutdown/s6-linux-init-shutdown.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/shutdown/s6-linux-init-shutdown.c b/src/shutdown/s6-linux-init-shutdown.c index 757ca7c..8e310ec 100644 --- a/src/shutdown/s6-linux-init-shutdown.c +++ b/src/shutdown/s6-linux-init-shutdown.c @@ -33,8 +33,6 @@ #define AC_FILE "/etc/shutdown.allow" #define AC_BUFSIZE 4096 #define AC_MAX 64 -#define AC_SHORT_MESSAGE "no authorized users logged in\n" -#define AC_MESSAGE "s6-linux-init-shutdown: " AC_SHORT_MESSAGE /* shutdown 01:23: date/time format parsing */ @@ -153,7 +151,6 @@ static inline int match_users_with_utmp (char const *const *users, unsigned int for (unsigned int i = 0 ; i < n ; i++) if (!strncmp(utx->ut_user, users[i], UT_NAMESIZE)) goto yes ; } - if (errno) strerr_warnwu1sys("getutxent") ; endutxent() ; return 0 ; @@ -188,14 +185,7 @@ static inline void access_control (void) buf[st.st_size] = 0 ; n = parse_authorized_users(buf, users, AC_MAX) ; if (!n || !match_users_with_utmp(users, n)) - { - fd = open_append("/dev/console") ; - if (fd == -1) - strerr_diefu1sys(111, "open /dev/console") ; - if (allwrite(fd, AC_MESSAGE, sizeof(AC_MESSAGE) - 1) < sizeof(AC_MESSAGE) - 1) - strerr_diefu1sys(111, "write to /dev/console") ; - strerr_dief1x(1, AC_SHORT_MESSAGE) ; - } + strerr_dief1x(1, "no authorized users logged in") ; } -- cgit v1.2.3