def_load: split the econf from non-econf definition
The function is completely different based on USE_CONF. Either copy will be easier to read if we just keep them completely separate. Signed-off-by: Serge Hallyn <serge@hallyn.com>
This commit is contained in:
parent
8175b1532e
commit
9e854f525d
26
lib/getdef.c
26
lib/getdef.c
@ -472,18 +472,13 @@ void setdef_config_file (const char* file)
|
|||||||
* Loads the user-configured options from the default configuration file
|
* Loads the user-configured options from the default configuration file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef USE_ECONF
|
||||||
static void def_load (void)
|
static void def_load (void)
|
||||||
{
|
{
|
||||||
#ifdef USE_ECONF
|
|
||||||
econf_file *defs_file = NULL;
|
econf_file *defs_file = NULL;
|
||||||
econf_err error;
|
econf_err error;
|
||||||
char **keys;
|
char **keys;
|
||||||
size_t key_number;
|
size_t key_number;
|
||||||
#else
|
|
||||||
int i;
|
|
||||||
FILE *fp;
|
|
||||||
char buf[1024], *name, *value, *s;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the initialized flag.
|
* Set the initialized flag.
|
||||||
@ -491,8 +486,6 @@ static void def_load (void)
|
|||||||
*/
|
*/
|
||||||
def_loaded = true;
|
def_loaded = true;
|
||||||
|
|
||||||
#ifdef USE_ECONF
|
|
||||||
|
|
||||||
error = econf_readDirs (&defs_file, vendordir, sysconfdir, "login", "defs", " \t", "#");
|
error = econf_readDirs (&defs_file, vendordir, sysconfdir, "login", "defs", " \t", "#");
|
||||||
if (error) {
|
if (error) {
|
||||||
if (error == ECONF_NOFILE)
|
if (error == ECONF_NOFILE)
|
||||||
@ -528,7 +521,20 @@ static void def_load (void)
|
|||||||
|
|
||||||
econf_free (keys);
|
econf_free (keys);
|
||||||
econf_free (defs_file);
|
econf_free (defs_file);
|
||||||
#else
|
}
|
||||||
|
#else /* USE_ECONF */
|
||||||
|
static void def_load (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
FILE *fp;
|
||||||
|
char buf[1024], *name, *value, *s;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the initialized flag.
|
||||||
|
* (do it early to prevent recursion in putdef_str())
|
||||||
|
*/
|
||||||
|
def_loaded = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open the configuration definitions file.
|
* Open the configuration definitions file.
|
||||||
*/
|
*/
|
||||||
@ -592,8 +598,8 @@ static void def_load (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
(void) fclose (fp);
|
(void) fclose (fp);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif /* USE_ECONF */
|
||||||
|
|
||||||
|
|
||||||
#ifdef CKDEFS
|
#ifdef CKDEFS
|
||||||
|
Loading…
Reference in New Issue
Block a user