]> err.no Git - yubikey-server-c/commitdiff
Complain earlier if we can't open the configuration file
authorTollef Fog Heen <tfheen@err.no>
Wed, 27 Jan 2010 21:06:27 +0000 (22:06 +0100)
committerTollef Fog Heen <tfheen@err.no>
Wed, 27 Jan 2010 21:06:27 +0000 (22:06 +0100)
src/main.c

index 55595f044f5b58948aee2ad323ed1b0246b0b35a..8b394a4bbcf72ba145b8bafb3ace29bd087ef485 100644 (file)
@@ -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')