Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/add.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/add.c')
-rw-r--r--lib/libalpm/add.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index a60b0633..689172c5 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -447,17 +447,20 @@ int add_commit(pmtrans_t *trans, pmdb_t *db)
if(nb) {
char *temp;
char *md5_local, *md5_pkg;
+ int fd;
- md5_local = MDFile(expath);
/* extract the package's version to a temporary file and md5 it */
temp = strdup("/tmp/alpm_XXXXXX");
- mkstemp(temp);
+ fd = mkstemp(temp);
if(tar_extract_file(tar, temp)) {
alpm_logaction("could not extract %s (%s)", pathname, strerror(errno));
errors++;
- FREE(md5_local);
+ unlink(temp);
+ FREE(temp);
+ close(fd);
continue;
}
+ md5_local = MDFile(expath);
md5_pkg = MDFile(temp);
/* append the new md5 hash to it's respective entry in info->backup
* (it will be the new orginal)
@@ -550,6 +553,7 @@ int add_commit(pmtrans_t *trans, pmdb_t *db)
FREE(md5_orig);
unlink(temp);
FREE(temp);
+ close(fd);
} else {
if(!notouch) {
_alpm_log(PM_LOG_FLOW2, "extracting %s", pathname);