Fix bandb's interaction with --enable-fhs-paths by storing ban.db in the correct directory, pkglocalstatedir.

This commit is contained in:
Nathan Phillip Brink 2012-03-01 03:39:54 +00:00
parent c74836dc4a
commit 96b8a6edce
2 changed files with 6 additions and 6 deletions

View file

@ -58,16 +58,16 @@ mlog(const char *errstr, ...)
int
rsdb_init(rsdb_error_cb * ecb)
{
const char *bandb_dpath;
const char *bandb_dbpath_env;
char dbpath[PATH_MAX];
char errbuf[128];
error_cb = ecb;
/* try a path from the environment first, useful for basedir overrides */
bandb_dpath = getenv("BANDB_DPATH");
bandb_dbpath_env = getenv("BANDB_DBPATH");
if(bandb_dpath != NULL)
rb_snprintf(dbpath, sizeof(dbpath), "%s/etc/ban.db", bandb_dpath);
if(bandb_dbpath_env != NULL)
rb_strlcpy(dbpath, bandb_dbpath_env, sizeof(dbpath));
else
rb_strlcpy(dbpath, DBPATH, sizeof(dbpath));

View file

@ -82,7 +82,7 @@ start_bandb(void)
const char *suffix = "";
#endif
rb_setenv("BANDB_DPATH", ConfigFileEntry.dpath, 1);
rb_setenv("BANDB_DBPATH", PKGLOCALSTATEDIR "/ban.db", 1);
if(bandb_path == NULL)
{
rb_snprintf(fullpath, sizeof(fullpath), "%s/bandb%s", PKGLIBEXECDIR, suffix);