From cc3c8db022b248d3b862757379b4df529d07b6c1 Mon Sep 17 00:00:00 2001 From: Steven Schubiger Date: Sun, 25 Jan 2015 16:54:10 +0100 Subject: Reuse file opening function --- colorize.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'colorize.c') 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; } -- cgit v1.2.3