@@ -99,10 +99,6 @@ static void parse_opts(int argc, char **argv)
exit(EXIT_FAILURE);
}
}
-
- if(parseconfigfile(config_file) != 0 || setdefaults(config) != 0) {
- fprintf(stderr, "error parsing '%s'\n", config_file);
- }
}
static void list_repos(void)
@@ -402,8 +398,16 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
- config = config_new();
parse_opts(argc, argv);
+
+ if(!(config = config_new())) {
+ /* config_new prints the appropriate error message */
+ return EXIT_FAILURE;
+ }
+ if(parseconfigfile(config_file) != 0 || setdefaults(config) != 0) {
+ fprintf(stderr, "error parsing '%s'\n", config_file);
+ return EXIT_FAILURE;
+ }
if(!config) {
return EXIT_FAILURE;
}