fix: exit when dup()ing stdin fails
parent
1871098942
commit
2fac47f1c7
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue