0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-14 16:08:19 +02:00

bandb: show the path of the database file when complaining about opening it

This commit is contained in:
William Pitcock 2016-07-30 21:14:52 -05:00
parent 12ef3b15d6
commit e64c51e71c

View file

@ -58,7 +58,7 @@ rsdb_init(rsdb_error_cb * ecb)
{
const char *bandb_dbpath_env;
char dbpath[PATH_MAX];
char errbuf[128];
char errbuf[1024];
error_cb = ecb;
/* try a path from the environment first, useful for basedir overrides */
@ -71,14 +71,15 @@ rsdb_init(rsdb_error_cb * ecb)
if(sqlite3_open(dbpath, &rb_bandb) != SQLITE_OK)
{
snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database: %s",
sqlite3_errmsg(rb_bandb));
snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database ('%s'): %s",
dbpath, sqlite3_errmsg(rb_bandb));
mlog(errbuf);
return -1;
}
if(access(dbpath, W_OK))
{
snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database for write: %s", strerror(errno));
snprintf(errbuf, sizeof(errbuf), "Unable to open sqlite database ('%s') for write: %s",
dbpath, strerror(errno));
mlog(errbuf);
return -1;
}