diff options
author | joerg <joerg@pkgsrc.org> | 2008-05-25 19:41:18 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2008-05-25 19:41:18 +0000 |
commit | b39716c20b623ac85787b669363ba3f534d06e1a (patch) | |
tree | 9de2580634ccb9d590062a8956ab0a9be93db8d6 /archivers/libarchive/files/tar/read.c | |
parent | 8958141f9f3a47aa065779b39aba25bc077b3375 (diff) | |
download | pkgsrc-b39716c20b623ac85787b669363ba3f534d06e1a.tar.gz |
Import libarchive-2.5.4b. Major changes:
- much improved mtree support
- fix a number of non-exploitable integer and buffer overflows
- bsdtar get -s and SIGINFO/SIGUSR1 support
- fix hardlink extraction bug where latter hardlinks would overwrite the
permissions of earlier entries even when they don't carry data
- fix bsdtar crashes on entries with empty filenames
Diffstat (limited to 'archivers/libarchive/files/tar/read.c')
-rw-r--r-- | archivers/libarchive/files/tar/read.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/archivers/libarchive/files/tar/read.c b/archivers/libarchive/files/tar/read.c index 279a10549d7..e1905b24867 100644 --- a/archivers/libarchive/files/tar/read.c +++ b/archivers/libarchive/files/tar/read.c @@ -24,7 +24,7 @@ */ #include "bsdtar_platform.h" -__FBSDID("$FreeBSD: src/usr.bin/tar/read.c,v 1.36 2008/03/15 03:06:46 kientzle Exp $"); +__FBSDID("$FreeBSD: src/usr.bin/tar/read.c,v 1.37 2008/05/18 06:24:47 cperciva Exp $"); #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> @@ -77,12 +77,28 @@ void tar_mode_t(struct bsdtar *bsdtar) { read_archive(bsdtar, 't'); + unmatched_inclusions_warn(bsdtar, "Not found in archive"); } void tar_mode_x(struct bsdtar *bsdtar) { + /* We want to catch SIGINFO and SIGUSR1. */ + siginfo_init(bsdtar); + read_archive(bsdtar, 'x'); + + unmatched_inclusions_warn(bsdtar, "Not found in archive"); + /* Restore old SIGINFO + SIGUSR1 handlers. */ + siginfo_done(bsdtar); +} + +static void +progress_func(void * cookie) +{ + struct bsdtar * bsdtar = cookie; + + siginfo_printinfo(bsdtar, 0); } /* @@ -119,6 +135,12 @@ read_archive(struct bsdtar *bsdtar, char mode) do_chdir(bsdtar); + if (mode == 'x') { + /* Set an extract callback so that we can handle SIGINFO. */ + archive_read_extract_set_progress_callback(a, progress_func, + bsdtar); + } + if (mode == 'x' && bsdtar->option_chroot) { #if HAVE_CHROOT if (chroot(".") != 0) @@ -150,6 +172,11 @@ read_archive(struct bsdtar *bsdtar, char mode) if (r == ARCHIVE_FATAL) break; + if (bsdtar->option_numeric_owner) { + archive_entry_set_uname(entry, NULL); + archive_entry_set_gname(entry, NULL); + } + /* * Exclude entries that are too old. */ @@ -238,6 +265,12 @@ read_archive(struct bsdtar *bsdtar, char mode) archive_entry_pathname(entry)); fflush(stderr); } + + /* Tell the SIGINFO-handler code what we're doing. */ + siginfo_setinfo(bsdtar, "extracting", + archive_entry_pathname(entry), 0); + siginfo_printinfo(bsdtar, 0); + if (bsdtar->option_stdout) r = archive_read_data_into_fd(a, 1); else |