From 25ca241a7cf5fcf4f594ff6cec7cb55807e333bf Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Tue, 21 Mar 2006 19:50:05 +0000 Subject: fixed dbpath initialization (found out by VMiklos ) --- src/pacman/pacman.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/pacman') 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)); -- cgit v1.2.3-70-g09d2