Use setmode instead of fdopen (#1520)

This commit is contained in:
Sylvie authored and GitHub committed 2024-09-29 14:06:59 -04:00
1 parent 9783671399
commit 4cd0dd5314
4 files changed
+18 -9

No files matched your search

+2 -1
View File
@@ -490,7 +490,8 @@ void obj_ReadFile(char const *fileName, unsigned int fileID) {
file = fopen(fileName, "rb");
} else {
fileName = "<stdin>";
file = fdopen(STDIN_FILENO, "rb"); // `stdin` is in text mode by default
(void)setmode(STDIN_FILENO, O_BINARY);
file = stdin;
}
if (!file)
err("Failed to open file \"%s\"", fileName);