From 7594af553ae3a189e7a7f9cf2f59c47af51441eb Mon Sep 17 00:00:00 2001 From: Colin Leroy-Mira Date: Sun, 28 Jan 2024 17:00:02 +0100 Subject: [PATCH] Fix #2388 Reopen stdin in binary mode instead of closing/opening --- test/ref/test_gets.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/ref/test_gets.c b/test/ref/test_gets.c index ee5b6fd58..003da5569 100644 --- a/test/ref/test_gets.c +++ b/test/ref/test_gets.c @@ -30,9 +30,7 @@ char *argv[]; #endif { /* Fake stdin with the reference file */ - fclose(stdin); - stdin = fopen(INFILE, "r"); - if (stdin == NULL) { + if (freopen(INFILE, "rb", stdin) == NULL) { return EXIT_FAILURE; }