diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-11-22 18:06:31 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-11-22 18:06:31 +0200 |
commit | da83a562e1fd81402a39b7c3edfdc413fa860d8c (patch) | |
tree | c061f93a19ffeb4957ea2bc22d2de84d09ce622f /rpmio/rpmfileutil.c | |
parent | 86645ffd4f45a799bc904df56ca9b2f48641d245 (diff) | |
download | rpm-da83a562e1fd81402a39b7c3edfdc413fa860d8c.tar.gz |
Add function to retrieve rpm config base directory
- one-shot to determine configuration base directory path from
RPM_CONFIGDIR environement or build-time default
- rpmfileutil is a bit strange place, this would really belong to librpm
but Lua initialization needs the path so...
Diffstat (limited to 'rpmio/rpmfileutil.c')
-rw-r--r-- | rpmio/rpmfileutil.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/rpmio/rpmfileutil.c b/rpmio/rpmfileutil.c index 5d2220e5b..7762c26cf 100644 --- a/rpmio/rpmfileutil.c +++ b/rpmio/rpmfileutil.c @@ -25,6 +25,8 @@ #include "debug.h" +static const char *rpm_config_dir = NULL; + static int open_dso(const char * path, pid_t * pidp, rpm_loff_t *fsizep) { static const char * cmd = NULL; @@ -727,3 +729,12 @@ int rpmMkdirs(const char *root, const char *pathstr) argvFree(dirs); return rc; } + +const char *rpmConfigDir(void) +{ + if (rpm_config_dir == NULL) { + char *rpmenv = getenv("RPM_CONFIGDIR"); + rpm_config_dir = rpmenv ? xstrdup(rpmenv) : RPMCONFIGDIR; + } + return rpm_config_dir; +} |