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 committed by JD Horelick
parent e8da6ccee6
commit 6bdef3d52f
2 changed files with 6 additions and 6 deletions

View File

@ -57,19 +57,19 @@ 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));
if(sqlite3_open(dbpath, &rb_bandb) != SQLITE_OK)
{
rb_snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database: %s",

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);