mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 15:00:51 +01:00
Fix bandb's interaction with --enable-fhs-paths by storing ban.db in the correct directory, pkglocalstatedir.
This commit is contained in:
parent
c74836dc4a
commit
96b8a6edce
2 changed files with 6 additions and 6 deletions
|
@ -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",
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue