diff options
author | Mike Yuan <me@yhndnzj.com> | 2023-12-22 11:28:55 +0100 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2023-12-22 16:06:49 +0100 |
commit | dd9c8da865932bb0fa63c1210006af0d2d716678 (patch) | |
tree | cae39195ce2a0ede22d2d5baca2774fe4e2314df /src/getty-generator | |
parent | terminal-util: introduce isatty_safe that rejects EBADF (diff) | |
download | systemd-dd9c8da865932bb0fa63c1210006af0d2d716678.tar.xz systemd-dd9c8da865932bb0fa63c1210006af0d2d716678.zip |
various: clean up isatty() handling
As per https://github.com/systemd/systemd/pull/30547#discussion_r1434371627
Diffstat (limited to 'src/getty-generator')
-rw-r--r-- | src/getty-generator/getty-generator.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c index 7486118365..288f91cedf 100644 --- a/src/getty-generator/getty-generator.c +++ b/src/getty-generator/getty-generator.c @@ -94,9 +94,8 @@ static int verify_tty(const char *name) { if (fd < 0) return -errno; - errno = 0; - if (isatty(fd) <= 0) - return errno_or_else(EIO); + if (!isatty_safe(fd)) + return -errno; return 0; } |