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/creds | |
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/creds')
-rw-r--r-- | src/creds/creds.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/creds/creds.c b/src/creds/creds.c index c9bf2e1e36..b53e8d3b36 100644 --- a/src/creds/creds.c +++ b/src/creds/creds.c @@ -315,7 +315,7 @@ static int print_newline(FILE *f, const char *data, size_t l) { /* Don't bother unless this is a tty */ fd = fileno(f); - if (fd >= 0 && isatty(fd) <= 0) + if (fd >= 0 && !isatty_safe(fd)) return 0; if (fputc('\n', f) != '\n') |