summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/db.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-06-04 15:39:00 -0400
committerDan McGee <dan@archlinux.org>2007-06-04 23:10:49 -0400
commit466b79bf8f9a9b3f37a1a754b40320df9f2f1b4e (patch)
treee43d592d812a8e631dc6155aa5419a78b4d26622 /lib/libalpm/db.c
parent358cc5804a2df873180e6d9ef2420ab3247f8437 (diff)
downloadpacman-466b79bf8f9a9b3f37a1a754b40320df9f2f1b4e.tar.xz
Fix up outstanding parseconfig issues
The db variable was left unset when calling alpm_db_register, leading to a failure to ever register a sync db. Also added a check to ensure DBPath was set when trying to register a database. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/db.c')
-rw-r--r--lib/libalpm/db.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index e5489973..16b09a47 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -186,6 +186,10 @@ pmdb_t *_alpm_db_register(const char *treename)
/* make sure the database directory exists */
dbpath = alpm_option_get_dbpath();
+ if(!dbpath) {
+ _alpm_log(PM_LOG_WARNING, _("database path is undefined"));
+ RET_ERR(PM_ERR_DB_OPEN, NULL);
+ }
snprintf(path, PATH_MAX, "%s%s", dbpath, treename);
if(stat(path, &buf) != 0 || !S_ISDIR(buf.st_mode)) {
_alpm_log(PM_LOG_DEBUG, _("database directory '%s' does not exist, creating it"),