From 0966c33a72ce172526762ac988ee6edbbba07b52 Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Fri, 30 May 2008 08:52:27 +0200 Subject: Get rid of double / in database paths. Errors like the following one happen regularly (for unknown reasons...) : error: could not open file /var/lib/pacman/local//glibc-2.7-9/depends: No such file or directory Anyway, every time an user reported an error like that, it always seemed like he thought the error was caused by the double /, which is obviously wrong. Since db->path always include a trailing /, there is no need to add one when concatenating paths in be_files.c or add.c. Additionally, some static strings were switched to dynamic. And the computation of the "dbpath"/"pkgname"-"pkgversion" was refactored in db_read, db_write and db_remove with a get_pkgpath static function. Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee --- lib/libalpm/add.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/libalpm/add.c') diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 03698622..6cf865ab 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -289,12 +289,12 @@ static int extract_single_file(struct archive *archive, if(strcmp(entryname, ".INSTALL") == 0) { /* the install script goes inside the db */ - snprintf(filename, PATH_MAX, "%s/%s-%s/install", db->path, + snprintf(filename, PATH_MAX, "%s%s-%s/install", db->path, newpkg->name, newpkg->version); archive_entry_set_mode(entry, 0644); } else if(strcmp(entryname, ".CHANGELOG") == 0) { /* the changelog goes inside the db */ - snprintf(filename, PATH_MAX, "%s/%s-%s/changelog", db->path, + snprintf(filename, PATH_MAX, "%s%s-%s/changelog", db->path, newpkg->name, newpkg->version); archive_entry_set_mode(entry, 0644); } else if(*entryname == '.') { -- cgit v1.2.3-24-g4f1b