Ensure we don't have double slashes when creating frontend paths

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>
This commit is contained in:
Dan McGee 2008-09-28 19:33:56 -05:00
parent 242e9e90f4
commit 18452a6c51
1 changed files with 4 additions and 2 deletions

View File

@ -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);
}
}