Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-05-19 17:17:32 -0500
committerDan McGee <dan@archlinux.org>2011-05-19 17:17:32 -0500
commit11fb9c767450dc193bbeef755c228aa620df75d9 (patch)
tree9f47a77d27b39ee7ddef40edba7bed3016d3ba08 /lib
parent70cf4546d6d35ef9ef2751f37853cde679c88aa7 (diff)
parentf2c4e7e55220addef0581d1c38cc7363b5a0884c (diff)
Merge branch 'maint'
Conflicts: lib/libalpm/trans.c src/pacman/query.c
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/remove.c2
-rw-r--r--lib/libalpm/trans.c19
2 files changed, 11 insertions, 10 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index cf416d52..2d840ceb 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -265,7 +265,7 @@ static void unlink_file(pmpkg_t *info, char *filename, alpm_list_t *skip_remove,
FREE(pkghash);
} else {
char *filehash = alpm_compute_md5sum(file);
- int cmp = strcmp(filehash,pkghash);
+ int cmp = filehash ? strcmp(filehash, pkghash) : 0;
FREE(filehash);
FREE(pkghash);
if(cmp != 0) {
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 4e88668b..af1bccee 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -116,15 +116,6 @@ int SYMEXPORT alpm_trans_init(pmtransflag_t flags,
}
}
- /* check database version */
- db_version = _alpm_db_version(handle->db_local);
- if(db_version < required_db_version) {
- _alpm_log(PM_LOG_ERROR,
- _("%s database version is too old\n"), handle->db_local->treename);
- remove_lock(handle);
- RET_ERR(PM_ERR_DB_VERSION, -1);
- }
-
trans = _alpm_trans_new();
if(trans == NULL) {
RET_ERR(PM_ERR_MEMORY, -1);
@@ -138,6 +129,16 @@ int SYMEXPORT alpm_trans_init(pmtransflag_t flags,
handle->trans = trans;
+ /* check database version */
+ db_version = _alpm_db_version(handle->db_local);
+ if(db_version < required_db_version) {
+ _alpm_log(PM_LOG_ERROR,
+ _("%s database version is too old\n"), handle->db_local->treename);
+ remove_lock(handle);
+ _alpm_trans_free(trans);
+ RET_ERR(PM_ERR_DB_VERSION, -1);
+ }
+
return 0;
}