index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Armin K <krejzi@email.com> | 2017-03-06 21:15:20 +0100 |
---|---|---|
committer | Andrew Gregory <andrew.gregory.8@gmail.com> | 2017-05-08 23:27:44 -0400 |
commit | 908769b54002e104b90ab2b3e5ca8066affd4394 (patch) | |
tree | 17e6a3131ba3582cf3bf0a450c77b70f9d1b1a8a /lib/libalpm/add.c | |
parent | 33dbe13a6b9da842de0fb6a1055651866bcf6440 (diff) |
-rw-r--r-- | lib/libalpm/add.c | 16 |
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index d132e522..065f3cea 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -110,6 +110,7 @@ static int perform_extraction(alpm_handle_t *handle, struct archive *archive, struct archive_entry *entry, const char *filename) { int ret; + struct archive *archive_writer; const int archive_flags = ARCHIVE_EXTRACT_OWNER | ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_TIME | @@ -118,7 +119,20 @@ static int perform_extraction(alpm_handle_t *handle, struct archive *archive, archive_entry_set_pathname(entry, filename); - ret = archive_read_extract(archive, entry, archive_flags); + archive_writer = archive_write_disk_new(); + if (archive_writer == NULL) { + _alpm_log(handle, ALPM_LOG_ERROR, _("cannot allocate disk archive object")); + alpm_logaction(handle, ALPM_CALLER_PREFIX, + "error: cannot allocate disk archive object"); + return 1; + } + + archive_write_disk_set_options(archive_writer, archive_flags); + + ret = archive_read_extract2(archive, entry, archive_writer); + + archive_write_free(archive_writer); + if(ret == ARCHIVE_WARN && archive_errno(archive) != ENOSPC) { /* operation succeeded but a "non-critical" error was encountered */ _alpm_log(handle, ALPM_LOG_WARNING, _("warning given when extracting %s (%s)\n"), |