From: =?utf-8?q?Christian_G=C3=B6ttsche?= Date: Tue, 12 Nov 2024 20:58:54 +0100 Forwarded: not-needed Subject: Ignore putline() failure on nonexistent utmp file The utmp file might not exist in favor of the new wtmp database. --- utempter.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/utempter.c b/utempter.c index 041ee4e..6aac0a7 100644 --- a/utempter.c +++ b/utempter.c @@ -113,8 +113,13 @@ write_uwtmp_record(const char *user, const char *term, const char *host, ut.ut_tv.tv_usec = (__typeof__(ut.ut_tv.tv_usec)) tv.tv_usec; setutent(); - if (!pututline(&ut)) + if (!pututline(&ut)) { + int err = errno; + endutent(); + if (err == ENOENT) + return EXIT_FAILURE; fatal_error("pututline: %s", strerror(errno)); + } endutent(); (void) updwtmp(_PATH_WTMP, &ut);