commit 642f111f980db82c0a5f91982e56d08ef9f01409
parent ff4cdc49d86d0dc2c6afee89203cc9a883fee0f8
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 27 Jun 2020 10:32:25 +0200
simplify checking for isatty()
Diffstat:
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -1038,9 +1038,6 @@ loadfiles(int argc, char *argv[])
FILE *fp;
size_t i;
char *name;
- int istty;
-
- istty = isatty(ttyfd);
feeds = ecalloc(argc, sizeof(struct feed));
@@ -1079,7 +1076,7 @@ loadfiles(int argc, char *argv[])
feed_loadfile(&feeds[0], feeds[0].path);
}
- if (!istty) {
+ if (!isatty(ttyfd)) {
close(ttyfd);
if ((ttyfd = open("/dev/tty", O_RDONLY)) == -1)
err(1, "open: /dev/tty");