From: Lennart Poettering Date: Tue, 22 Nov 2022 11:56:38 +0000 (+0100) Subject: utmp-wtmp: fix error in case isatty() fails X-Git-Tag: v253-rc1~458^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=80b780ba178a84b248ecee47eef82358480c9492;p=thirdparty%2Fsystemd.git utmp-wtmp: fix error in case isatty() fails --- diff --git a/src/shared/utmp-wtmp.c b/src/shared/utmp-wtmp.c index d2c8473c60f..20add0e81b0 100644 --- a/src/shared/utmp-wtmp.c +++ b/src/shared/utmp-wtmp.c @@ -292,8 +292,10 @@ static int write_to_terminal(const char *tty, const char *message) { assert(message); fd = open(tty, O_WRONLY|O_NONBLOCK|O_NOCTTY|O_CLOEXEC); - if (fd < 0 || !isatty(fd)) + if (fd < 0) return -errno; + if (!isatty(fd)) + return -ENOTTY; p = message; left = strlen(message);