X-Git-Url: http://the.earth.li/gitweb/?a=blobdiff_plain;f=onak-conf.c;h=ccad3c5a78f800dde720e8562456fab44d119a19;hb=5e40e676a7c4f640c9f850a379300c01a5fca69c;hp=e3085e1996be9e1fa6ec7690ea8f70fdf7e10951;hpb=8e0907be1d73011075a99a0c029c56664e12843e;p=onak.git diff --git a/onak-conf.c b/onak-conf.c index e3085e1..ccad3c5 100644 --- a/onak-conf.c +++ b/onak-conf.c @@ -118,7 +118,12 @@ void readconfig(const char *configfile) { conffile = fopen(configfile, "r"); } if (conffile != NULL) { - fgets(curline, 1023, conffile); + if (!fgets(curline, 1023, conffile)) { + logthing(LOGTHING_CRITICAL, + "Problem reading configuration file."); + fclose(conffile); + return; + } while (!feof(conffile)) { for (i = strlen(curline) - 1; @@ -203,7 +208,12 @@ void readconfig(const char *configfile) { "Unknown config line: %s", curline); } - fgets(curline, 1023, conffile); + if (!fgets(curline, 1023, conffile) && + !feof(conffile)) { + logthing(LOGTHING_CRITICAL, + "Problem reading configuration file."); + break; + } } fclose(conffile); } else {