diff options
author | Lennart Poettering <lennart@poettering.net> | 2022-11-22 12:56:38 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2022-11-22 13:10:29 +0100 |
commit | 80b780ba178a84b248ecee47eef82358480c9492 (patch) | |
tree | b6d0be5996ade8f4d7f5a8ae08cb3a88f94fba64 /src/shared/utmp-wtmp.c | |
parent | homed: handle EINTR gracefully when waiting for device node (diff) | |
download | systemd-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.c | 4 |
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); |