diff options
author | Ludwig Nussel | 2012-05-25 10:54:23 +0200 |
---|---|---|
committer | Ludwig Nussel | 2012-05-25 10:55:40 +0200 |
commit | 9c44ac503f0d18348518f195b36c4ea83ab0ca76 (patch) | |
tree | c3b63cf412fe5abd99f00a58cf524f9325d4c060 /login-utils/logindefs.c | |
parent | syslog always (diff) | |
download | kernel-qcow2-util-linux-9c44ac503f0d18348518f195b36c4ea83ab0ca76.tar.gz kernel-qcow2-util-linux-9c44ac503f0d18348518f195b36c4ea83ab0ca76.tar.xz kernel-qcow2-util-linux-9c44ac503f0d18348518f195b36c4ea83ab0ca76.zip |
use existing logindefs.c and pathnames.h
I'm not sure having /usr/local in _PATH_DEFPATH_ROOT and even putting it
in front is such a good idea though. /usr/local might be on NFS so could
prevent root from logging in if the network is down.
Diffstat (limited to 'login-utils/logindefs.c')
-rw-r--r-- | login-utils/logindefs.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/login-utils/logindefs.c b/login-utils/logindefs.c index ff7266ea1..6117936b8 100644 --- a/login-utils/logindefs.c +++ b/login-utils/logindefs.c @@ -45,6 +45,8 @@ struct item { static struct item *list = NULL; +void (*logindefs_load_defaults)(void) = NULL; + void free_getlogindefs_data(void) { struct item *ptr; @@ -77,7 +79,7 @@ static void store(const char *name, const char *value, const char *path) list = new; } -static void load_defaults(const char *filename) +void logindefs_load_file(const char *filename) { FILE *f; char buf[BUFSIZ]; @@ -139,12 +141,20 @@ static void load_defaults(const char *filename) fclose(f); } +static void load_defaults() +{ + if (logindefs_load_defaults) + logindefs_load_defaults(); + else + logindefs_load_file(_PATH_LOGINDEFS); +} + static struct item *search(const char *name) { struct item *ptr; if (!list) - load_defaults(_PATH_LOGINDEFS); + load_defaults(); ptr = list; while (ptr != NULL) { @@ -259,7 +269,7 @@ int main(int argc, char *argv[]) errx(EXIT_FAILURE, "usage: %s <filename> " "[<str|num|bool> <valname>]", argv[0]); - load_defaults(argv[1]); + logindefs_load_file(argv[1]); if (argc != 4) { /* list all */ struct item *ptr; |