utmp-wtmp: fix error in case isatty() fails

This commit is contained in:
Lennart Poettering
2022-11-22 13:10:29 +01:00
parent f3d9278f38
commit 80b780ba17
+3 -1
View File
@@ -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);