From: Tollef Fog Heen Date: Wed, 27 Jan 2010 21:06:27 +0000 (+0100) Subject: Complain earlier if we can't open the configuration file X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=135a3e666d22523552420239c6037df0ba0c5eb9;p=yubikey-server-c Complain earlier if we can't open the configuration file --- 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')