aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Steven Schubiger <stsc@refcnt.org> 2015-01-25 16:54:10 +0100
committerGravatar Steven Schubiger <stsc@refcnt.org> 2015-01-25 16:54:10 +0100
commitcc3c8db022b248d3b862757379b4df529d07b6c1 (patch)
tree9e53a1e9d7a497467d1068b4993c125609560293
parent20c83df5d03e4b89d3a93803db0f9f9307517faf (diff)
downloadcolorize-cc3c8db022b248d3b862757379b4df529d07b6c1.tar.gz
colorize-cc3c8db022b248d3b862757379b4df529d07b6c1.tar.bz2
Reuse file opening function
-rw-r--r--colorize.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/colorize.c b/colorize.c
index 1325fce..cc89193 100644
--- a/colorize.c
+++ b/colorize.c
@@ -666,7 +666,6 @@ process_file_arg (const char *file_string, const char **file, FILE **stream)
*stream = stdin;
else
{
- FILE *s;
const char *file = file_string;
struct stat sb;
int ret;
@@ -680,12 +679,7 @@ process_file_arg (const char *file_string, const char **file, FILE **stream)
if (!VALID_FILE_TYPE (sb.st_mode))
vfprintf_fail (formats[FMT_TYPE], file, "unrecognized type", get_file_type (sb.st_mode));
- errno = 0;
-
- s = fopen (file, "r");
- if (!s)
- vfprintf_fail (formats[FMT_FILE], file, strerror (errno));
- *stream = s;
+ *stream = open_file (file, "r");
}
*file = file_string;
}