From 1e80be48406437537d8ba2c1fac2f726f40bd64f Mon Sep 17 00:00:00 2001 From: Humm Date: Fri, 29 Jan 2021 10:55:42 +0100 Subject: [PATCH] use freopen(3) correctly --- src/nmstermio.c | 2 +- src/nmstermio_ncurses.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nmstermio.c b/src/nmstermio.c index f4f082c..2aa8ca2 100644 --- a/src/nmstermio.c +++ b/src/nmstermio.c @@ -296,7 +296,7 @@ static void nmstermio_set_terminal(int s) { static int state = 1; if (!isatty(STDIN_FILENO)) { - stdin = freopen("/dev/tty", "r", stdin); + freopen("/dev/tty", "r", stdin); } if (s == 0) { diff --git a/src/nmstermio_ncurses.c b/src/nmstermio_ncurses.c index 928ede7..7836087 100644 --- a/src/nmstermio_ncurses.c +++ b/src/nmstermio_ncurses.c @@ -28,7 +28,7 @@ static int foregroundColor = COLOR_BLUE; // Foreground color settin */ void nmstermio_init_terminal(void) { if (!isatty(STDIN_FILENO)) { - stdin = freopen("/dev/tty", "r", stdin); + freopen("/dev/tty", "r", stdin); } initscr(); cbreak();