summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/pacman/pacman.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 55e92098..a2ff2604 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -476,9 +476,14 @@ int main(int argc, char *argv[])
ERR(NL, "failed to set option LOGCB (%s)\n", alpm_strerror(pm_errno));
cleanup(1);
}
- if(alpm_set_option(PM_OPT_DBPATH, (long)config->dbpath) == -1) {
- ERR(NL, "failed to set option DBPATH (%s)\n", alpm_strerror(pm_errno));
- cleanup(1);
+ if(config->dbpath == NULL) {
+ config->dbpath = strdup(PM_DBPATH);
+ } else {
+ /* dbpath has been set by parseargs or parseconfig */
+ if(alpm_set_option(PM_OPT_DBPATH, (long)config->dbpath) == -1) {
+ ERR(NL, "failed to set option DBPATH (%s)\n", alpm_strerror(pm_errno));
+ cleanup(1);
+ }
}
if(alpm_set_option(PM_OPT_CACHEDIR, (long)config->cachedir) == -1) {
ERR(NL, "failed to set option CACHEDIR (%s)\n", alpm_strerror(pm_errno));