summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-02-11 20:15:44 -0600
committerDan McGee <dan@archlinux.org>2008-02-11 20:40:44 -0600
commit8068a14c5217989a25a03fa1677086c086ad90d6 (patch)
tree3bb0f7fb908b36b55becd212981a495fc52ea1e2
parent9bf487b2ff0a3f56bd8e2159a7688264950f3a02 (diff)
setlibpaths(): remove a stray set_option line
For some reason, we set our dbpath to the logfile path, which was completely broken, and we didn't even check the return value coming back (which of course was -1 meaning the set failed). Add some comments so people can understand what is going on here now too. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--src/pacman/pacman.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 27130254..377ea3fe 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -227,11 +227,11 @@ static void cleanup(int signum)
exit(signum);
}
-/** Sets all libalpm required paths in one go. Called after the command line and
- * inital config file parsing. Once this is complete, we can see if any paths were
- * defined. If a rootdir was defined and nothing else, we want all of our paths to
- * live under the rootdir that was specified. Safe to call multiple times (will only
- * do anything the first time).
+/** Sets all libalpm required paths in one go. Called after the command line
+ * and inital config file parsing. Once this is complete, we can see if any
+ * paths were defined. If a rootdir was defined and nothing else, we want all
+ * of our paths to live under the rootdir that was specified. Safe to call
+ * multiple times (will only do anything the first time).
*/
static void setlibpaths(void)
{
@@ -240,6 +240,8 @@ static void setlibpaths(void)
int ret = 0;
pm_printf(PM_LOG_DEBUG, "setlibpaths() called\n");
+ /* Configure root path first. If it is set and dbpath/logfile were not
+ * set, then set those as well to reside under the root. */
if(config->rootdir) {
char path[PATH_MAX];
ret = alpm_option_set_root(config->rootdir);
@@ -254,10 +256,12 @@ static void setlibpaths(void)
}
if(!config->logfile) {
snprintf(path, PATH_MAX, "%s%s", alpm_option_get_root(), LOGFILE);
- ret = alpm_option_set_dbpath(path);
config->logfile = strdup(path);
}
}
+ /* Set other paths if they were configured. Note that unless rootdir
+ * was left undefined, these two paths (dbpath and logfile) will have
+ * been set locally above, so the if cases below will now trigger. */
if(config->dbpath) {
ret = alpm_option_set_dbpath(config->dbpath);
if(ret != 0) {