summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-04-10 20:54:34 -0500
committerDan McGee <dan@archlinux.org>2008-04-10 20:54:34 -0500
commit4bd0a850953b97cdf6ee6b96871302d9ceb2bcec (patch)
treee6c3945cd00561ead1c8883b3442b405f0090101 /lib/libalpm
parente9a0d35d088d89e26c7dd2820a2f61359d213700 (diff)
parent4b7f7e2a59457aa881ae883b6d102f9fc62e2ed8 (diff)
Merge branch 'maint'
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/add.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 05935a7b..29af08f6 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -431,7 +431,7 @@ static int extract_single_file(struct archive *archive,
}
if(needbackup) {
- char *tempfile = NULL;
+ char *tempfile;
char *hash_local = NULL, *hash_pkg = NULL;
int fd;
@@ -439,9 +439,8 @@ static int extract_single_file(struct archive *archive,
tempfile = strdup("/tmp/alpm_XXXXXX");
fd = mkstemp(tempfile);
- archive_entry_set_pathname(entry, tempfile);
-
- int ret = archive_read_extract(archive, entry, archive_flags);
+ int ret = archive_read_data_into_fd(archive, fd);
+ close(fd);
if(ret == ARCHIVE_WARN) {
/* operation succeeded but a non-critical error was encountered */
_alpm_log(PM_LOG_DEBUG, "warning extracting %s (%s)\n",
@@ -452,8 +451,8 @@ static int extract_single_file(struct archive *archive,
alpm_logaction("error: could not extract %s (%s)\n",
entryname, archive_error_string(archive));
unlink(tempfile);
+ FREE(tempfile);
FREE(hash_orig);
- close(fd);
return(1);
}
@@ -563,7 +562,6 @@ static int extract_single_file(struct archive *archive,
FREE(hash_orig);
unlink(tempfile);
FREE(tempfile);
- close(fd);
} else {
/* we didn't need a backup */
if(notouch) {