From 135a3e666d22523552420239c6037df0ba0c5eb9 Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Wed, 27 Jan 2010 22:06:27 +0100 Subject: [PATCH] Complain earlier if we can't open the configuration file --- src/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main.c b/src/main.c index 55595f0..8b394a4 100644 --- a/src/main.c +++ b/src/main.c @@ -512,6 +512,11 @@ int parse_config(const char *file, struct ykc_config *c) char *key, *value; f = fopen(file, "r"); + if (f == NULL) { + fprintf(stderr, "Can't open configuration file %s: %s; exiting", + file, strerror(errno)); + exit(1); + } while (fgets(line, sizeof(line), f) != NULL) { if (line[0] == '#' || line[0] == '\n') -- 2.39.5