summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-03-15 23:03:29 -0500
committerDan McGee <dan@archlinux.org>2010-03-15 23:06:22 -0500
commitf6c7de77edee89650e8dabf728f296d48cd4b3e0 (patch)
tree67c765132a51a7c8eb6e78e0246398220157d11f /lib/libalpm
parenta36ff9404b59b249b436282f5b69d8ed136a7c8d (diff)
downloadpacman-f6c7de77edee89650e8dabf728f296d48cd4b3e0.tar.xz
Unbreak the database partial extraction code
Basically I'm the idiot that thought I could make it better and completely forgot how freeing the contents of the original lists would screw up our nice little diff extraction lists. This caused segfaults among other problems. Last time I try to do that... Program received signal SIGSEGV, Segmentation fault. 0x00007ffff627ce26 in strcmp () from /lib/libc.so.6 (gdb) bt Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/be_files.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index 4ddb1369..955351ce 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -210,7 +210,8 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
{
char *dbfile, *dbfilepath;
const char *dbpath, *syncdbpath;
- alpm_list_t *filelist = NULL;
+ alpm_list_t *newdirlist = NULL, *olddirlist = NULL;
+ alpm_list_t *onlynew = NULL, *onlyold = NULL;
size_t len;
int ret;
@@ -266,28 +267,18 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
}
} else {
/* if not forcing, only remove and extract what is necessary */
- alpm_list_t *newdirlist = NULL;
- alpm_list_t *olddirlist = NULL;
- alpm_list_t *onlyold = NULL;
-
ret = dirlist_from_tar(dbfilepath, &newdirlist);
if(ret) {
- FREELIST(newdirlist);
goto cleanup;
}
ret = dirlist_from_fs(syncdbpath, &olddirlist);
if(ret) {
- FREELIST(olddirlist);
- FREELIST(newdirlist);
goto cleanup;
}
- alpm_list_diff_sorted(olddirlist, newdirlist, _alpm_str_cmp, &onlyold, &filelist);
- FREELIST(olddirlist);
- FREELIST(newdirlist);
+ alpm_list_diff_sorted(olddirlist, newdirlist, _alpm_str_cmp, &onlyold, &onlynew);
ret = remove_olddir(syncdbpath, onlyold);
- alpm_list_free(onlyold);
if(ret) {
goto cleanup;
}
@@ -297,9 +288,14 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
_alpm_db_free_pkgcache(db);
checkdbdir(db);
- ret = _alpm_unpack(dbfilepath, syncdbpath, filelist, 0);
+ ret = _alpm_unpack(dbfilepath, syncdbpath, onlynew, 0);
cleanup:
+ FREELIST(newdirlist);
+ FREELIST(olddirlist);
+ alpm_list_free(onlynew);
+ alpm_list_free(onlyold);
+
free(dbfilepath);
if(ret) {