From 96b8a6edce25357399c897dc3ab12fe766663aac Mon Sep 17 00:00:00 2001 From: Nathan Phillip Brink Date: Thu, 1 Mar 2012 03:39:54 +0000 Subject: [PATCH] Fix bandb's interaction with --enable-fhs-paths by storing ban.db in the correct directory, pkglocalstatedir. --- bandb/rsdb_sqlite3.c | 10 +++++----- src/bandbi.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bandb/rsdb_sqlite3.c b/bandb/rsdb_sqlite3.c index 2df2bf6cc..e2c4f211b 100644 --- a/bandb/rsdb_sqlite3.c +++ b/bandb/rsdb_sqlite3.c @@ -58,19 +58,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", diff --git a/src/bandbi.c b/src/bandbi.c index 5c9933e26..e861b98ec 100644 --- a/src/bandbi.c +++ b/src/bandbi.c @@ -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);