diff options
author | Aurelien Foret <aurelien@archlinux.org> | 2006-03-21 19:50:05 +0000 |
---|---|---|
committer | Aurelien Foret <aurelien@archlinux.org> | 2006-03-21 19:50:05 +0000 |
commit | 25ca241a7cf5fcf4f594ff6cec7cb55807e333bf (patch) | |
tree | 1b80cf73c9d0deedd872ad2f76941a295fd61f1b /src | |
parent | 839a64df411115599bdef7a5c14d180111842523 (diff) |
fixed dbpath initialization (found out by VMiklos <vmiklos@frugalware.org>)
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/pacman.c | 11 |
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)); |