diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-05-06 01:50:56 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-05-06 01:50:56 +0000 |
commit | a8da8a0241e9e8bbe4d2c2be2e33f3053b95f94f (patch) | |
tree | 2b041ca8b5ea63318d36c96ac3145f165c256b7a /src | |
parent | b837b2ffeebf6af8f393f8e21405d0b7f265513b (diff) | |
download | s6-linux-init-a8da8a0241e9e8bbe4d2c2be2e33f3053b95f94f.tar.xz |
Fix hpr_wall utmp access, so is ut_id entirely unused?
Diffstat (limited to 'src')
-rw-r--r-- | src/shutdown/hpr_wall.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/shutdown/hpr_wall.c b/src/shutdown/hpr_wall.c index cc6da5e..e63ddea 100644 --- a/src/shutdown/hpr_wall.c +++ b/src/shutdown/hpr_wall.c @@ -1,7 +1,6 @@ /* ISC license. */ #include <string.h> -#include <errno.h> #include <utmpx.h> #include <skalibs/posixishard.h> @@ -25,23 +24,18 @@ void hpr_wall (char const *s) setutxent() ; for (;;) { - size_t linelen, idlen ; - struct utmpx *utx ; + size_t linelen ; int fd ; - errno = 0 ; - utx = getutxent() ; + struct utmpx *utx = getutxent() ; if (!utx) break ; if (utx->ut_type != USER_PROCESS) continue ; linelen = strnlen(utx->ut_line, UT_LINESIZE) ; - idlen = strnlen(utx->ut_id, 4) ; memcpy(tty + 5, utx->ut_line, linelen) ; - memcpy(tty + 5 + linelen, utx->ut_id, idlen) ; - tty[5 + linelen + idlen] = 0 ; + tty[5 + linelen] = 0 ; fd = open_append(tty) ; if (fd == -1) continue ; allwrite(fd, msg, n) ; fd_close(fd) ; } - if (errno) strerr_warnwu1sys("getutxent") ; endutxent() ; } |