ref: 642daf1a76847fbe4b361f3d0810b60c41aad89e
parent: 84edfb3d885e84f7ca8e02c3db11ca29718a8e3f
author: daid <daid303@gmail.com>
date: Tue Nov 3 08:33:57 EST 2020
Update main.c
--- a/src/link/main.c
+++ b/src/link/main.c
@@ -128,13 +128,12 @@
return NULL;
FILE *file;
- if (strcmp(fileName, "-") != 0) {
+ if (strcmp(fileName, "-") != 0)
file = fopen(fileName, mode);
- } else if (strchr(mode, 'r')) {
+ else if (mode[0] == 'r')
file = fdopen(0, mode);
- } else {
+ else
file = fdopen(1, mode);
- }
if (!file)
err(1, "Could not open file \"%s\"", fileName);