fix: exit when dup()ing stdin fails

master
BodgeMaster 2025-02-06 11:29:43 +01:00
parent 1871098942
commit 2fac47f1c7
1 changed files with 1 additions and 0 deletions

View File

@ -58,6 +58,7 @@ int main(int argc, char** argv) {
stdin_dup = dup(fileno(stdin)); stdin_dup = dup(fileno(stdin));
if (stdin_dup == -1) { if (stdin_dup == -1) {
fprintf(stderr, "Failed to dup() stdin: %s\n", strerror(errno)); fprintf(stderr, "Failed to dup() stdin: %s\n", strerror(errno));
return EXIT_RUNTIME;
} }
if (freopen(NULL, "wb", stdout) == NULL) { if (freopen(NULL, "wb", stdout) == NULL) {