summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2006-03-21 19:50:05 +0000
committerAurelien Foret <aurelien@archlinux.org>2006-03-21 19:50:05 +0000
commit25ca241a7cf5fcf4f594ff6cec7cb55807e333bf (patch)
tree1b80cf73c9d0deedd872ad2f76941a295fd61f1b /src
parent839a64df411115599bdef7a5c14d180111842523 (diff)
downloadpacman-25ca241a7cf5fcf4f594ff6cec7cb55807e333bf.tar.xz
fixed dbpath initialization (found out by VMiklos <vmiklos@frugalware.org>)
Diffstat (limited to 'src')
-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));