summaryrefslogtreecommitdiffstats
path: root/src/creds
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/creds
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/creds')
-rw-r--r--src/creds/creds.c2
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')