diff --git a/NEWS.md b/NEWS.md index 0699fb70..1a8d8cf3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -16,6 +16,12 @@ Thanks to Benjamin Cathelineau, see ** Fix codespell typos. +** syslogd, talkd: Better compatibility with utmp-less GNU/Linux systems +when configuring with --enable-systemd. +Thanks to Valentin Haudiquet for reporting the issue and testing possible +solutions. For more info, see the thread starting at +. + # Noteworthy changes in release 2.6 (2025-02-21) [stable] ** The release tarball is now reproducible. diff --git a/libinetutils/ttymsg.c b/libinetutils/ttymsg.c index 74d73167..9d7db630 100644 --- a/libinetutils/ttymsg.c +++ b/libinetutils/ttymsg.c @@ -109,6 +109,17 @@ inetutils_ttymsg (struct iovec *iov, int iovcnt, char *line, int tmout) { if (errno == EBUSY || errno == EACCES) return (NULL); +#ifdef READUTMP_USE_SYSTEMD + /* + * GNU/Linux systems without utmp file but with utmp emulation + * provided via Gnulib's read_utmp() function regularly return + * non-existing TTYs for some active user sessions. This is a + * limitation of the utmp emulation. Thus ignore this error on + * such systems, but not others. + */ + if (errno == ENOENT) + return (NULL); +#endif snprintf (errbuf, sizeof (errbuf), "%s: %s", device, strerror (errno)); free (device); return errbuf;