commit 6e524876311fad92e9501cf04bfd9db88f1732ba
parent 0cc95d65cf944b0e7b101c917b3b8af531ba4924
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 19 Aug 2020 19:00:25 +0200
fix a file descriptor leak on startup when stdin is not a tty
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -1743,7 +1743,8 @@ main(int argc, char *argv[])
if ((fd = open("/dev/tty", O_RDONLY)) == -1)
die("open: /dev/tty");
if (dup2(fd, 0) == -1)
- die("dup2: /dev/tty");
+ die("dup2(%d, 0): /dev/tty -> stdin", fd);
+ close(fd);
}
if (argc == 1)
feeds[0].fp = NULL;