(dflt_econfig): New.
(emp_config): Use it when argument is NULL. This simplifies callers except pconfig's main(), which now has to suppress reading the default file. Also fix callers to check the return value. Previously, a typo could easily start a grossly misconfigured program, with potentially disastrous results.
This commit is contained in:
parent
12518b82dd
commit
1583d0c6a2
7 changed files with 23 additions and 32 deletions
|
@ -88,9 +88,13 @@ emp_config(char *file)
|
|||
int errors = 0;
|
||||
int i;
|
||||
|
||||
if (file == NULL) {
|
||||
fixup_files();
|
||||
return 0;
|
||||
if (!file) {
|
||||
if (!*dflt_econfig) {
|
||||
/* No default econfig, use compiled in configuration */
|
||||
fixup_files();
|
||||
return 0;
|
||||
}
|
||||
file = dflt_econfig;
|
||||
}
|
||||
if ((fp = fopen(file, "r")) == NULL) {
|
||||
fprintf(stderr, "Can't open %s for reading (%s)\n",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue