summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/config.c b/config.c
index 168b780..78190f5 100644
--- a/config.c
+++ b/config.c
@@ -7,6 +7,7 @@ int getconfstr(char *confname, char *filename, char* dest) {
FILE *fp;
char *ret;
char str[MAXCHAR];
+ int found = 0; // Have we found the configuration option?
// Set strings to zero-length to begin
dest[0] = '\0';
@@ -39,14 +40,14 @@ int getconfstr(char *confname, char *filename, char* dest) {
// If the resulting temporary string contains the requested option name,
// we have found our configuration option and it is in the current 'str'
if (!(ret = strstr(substr, confname)) == 0) {
+ found = 1;
break;
}
}
// If we got here, then either we found the configuration option or we ran out of file
- // If str is NULL then we ran out of file
- if (ret == NULL) {
+ if (!found) {
printf("Error reading configuration option '%s', did not find it in configuration file '%s'.\n", confname, filename);
return 0;
}