summaryrefslogtreecommitdiffstats
path: root/src/getty-generator
diff options
context:
space:
mode:
authorMike Yuan <me@yhndnzj.com>2023-12-22 11:28:55 +0100
committerMike Yuan <me@yhndnzj.com>2023-12-22 16:06:49 +0100
commitdd9c8da865932bb0fa63c1210006af0d2d716678 (patch)
treecae39195ce2a0ede22d2d5baca2774fe4e2314df /src/getty-generator
parentterminal-util: introduce isatty_safe that rejects EBADF (diff)
downloadsystemd-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.c5
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;
}