From 18452a6c51827e91f37978397552c30cb92c26cd Mon Sep 17 00:00:00 2001
From: Dan McGee <dan@archlinux.org>
Date: Sun, 28 Sep 2008 19:33:56 -0500
Subject: Ensure we don't have double slashes when creating frontend paths
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Because libalpm always returns a root path with a trailing slash, when we
use it to create our unspecified paths we get double slashes in the result.
Use the fix suggested by Jürgen Hötzel to remedy this.

Signed-off-by: Dan McGee <dan@archlinux.org>
---
 src/pacman/pacman.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'src/pacman')

diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 81f07dac..3a56a9d3 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -262,11 +262,13 @@ static void setlibpaths(void)
 				cleanup(ret);
 			}
 			if(!config->dbpath) {
-				snprintf(path, PATH_MAX, "%s%s", alpm_option_get_root(), DBPATH);
+				/* omit leading slash from our static DBPATH, root handles it */
+				snprintf(path, PATH_MAX, "%s%s", alpm_option_get_root(), DBPATH + 1);
 				config->dbpath = strdup(path);
 			}
 			if(!config->logfile) {
-				snprintf(path, PATH_MAX, "%s%s", alpm_option_get_root(), LOGFILE);
+				/* omit leading slash from our static LOGFILE path, root handles it */
+				snprintf(path, PATH_MAX, "%s%s", alpm_option_get_root(), LOGFILE + 1);
 				config->logfile = strdup(path);
 			}
 		}
-- 
cgit v1.2.3-70-g09d2