summaryrefslogtreecommitdiffstats
path: root/src/shared/utmp-wtmp.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-11-22 12:56:38 +0100
committerLennart Poettering <lennart@poettering.net>2022-11-22 13:10:29 +0100
commit80b780ba178a84b248ecee47eef82358480c9492 (patch)
treeb6d0be5996ade8f4d7f5a8ae08cb3a88f94fba64 /src/shared/utmp-wtmp.c
parenthomed: handle EINTR gracefully when waiting for device node (diff)
downloadsystemd-80b780ba178a84b248ecee47eef82358480c9492.tar.xz
systemd-80b780ba178a84b248ecee47eef82358480c9492.zip
utmp-wtmp: fix error in case isatty() fails
Diffstat (limited to 'src/shared/utmp-wtmp.c')
-rw-r--r--src/shared/utmp-wtmp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/shared/utmp-wtmp.c b/src/shared/utmp-wtmp.c
index d2c8473c60..20add0e81b 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);