From owner-svn-src-all@FreeBSD.ORG Fri Apr 17 03:40:40 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAAB8106564A; Fri, 17 Apr 2009 03:40:40 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A9D9B8FC1B; Fri, 17 Apr 2009 03:40:40 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3H3eek9006413; Fri, 17 Apr 2009 03:40:40 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3H3eeUt006412; Fri, 17 Apr 2009 03:40:40 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904170340.n3H3eeUt006412@svn.freebsd.org> From: Tim Kientzle Date: Fri, 17 Apr 2009 03:40:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191189 - head/usr.bin/tar X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2009 03:40:41 -0000 Author: kientzle Date: Fri Apr 17 03:40:40 2009 New Revision: 191189 URL: http://svn.freebsd.org/changeset/base/191189 Log: Set options before opening the archive. Catch and report close-time errors. Modified: head/usr.bin/tar/read.c Modified: head/usr.bin/tar/read.c ============================================================================== --- head/usr.bin/tar/read.c Fri Apr 17 03:37:09 2009 (r191188) +++ head/usr.bin/tar/read.c Fri Apr 17 03:40:40 2009 (r191189) @@ -127,17 +127,13 @@ read_archive(struct bsdtar *bsdtar, char else archive_read_support_compression_all(a); archive_read_support_format_all(a); + if (ARCHIVE_OK != archive_read_set_options(a, bsdtar->option_options)) + bsdtar_errc(bsdtar, 1, 0, archive_error_string(a)); if (archive_read_open_file(a, bsdtar->filename, bsdtar->bytes_per_block != 0 ? bsdtar->bytes_per_block : DEFAULT_BYTES_PER_BLOCK)) bsdtar_errc(bsdtar, 1, 0, "Error opening archive: %s", archive_error_string(a)); - if (bsdtar->option_format_options != NULL) { - r = archive_read_set_options(a, bsdtar->option_format_options); - if (r != ARCHIVE_OK) - bsdtar_errc(bsdtar, 1, 0, "Error archive options: %s", - archive_error_string(a)); - } do_chdir(bsdtar); @@ -298,6 +294,13 @@ read_archive(struct bsdtar *bsdtar, char } } + + r = archive_read_close(a); + if (r != ARCHIVE_OK) + bsdtar_warnc(bsdtar, 0, "%s", archive_error_string(a)); + if (r <= ARCHIVE_WARN) + bsdtar->return_value = 1; + if (bsdtar->verbose > 2) fprintf(stdout, "Archive Format: %s, Compression: %s\n", archive_format_name(a), archive_compression_name(a)); @@ -390,7 +393,7 @@ list_item_verbose(struct bsdtar *bsdtar, /* Format the time using 'ls -l' conventions. */ tim = (time_t)st->st_mtime; -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__CYGWIN__) /* Windows' strftime function does not support %e format. */ if (abs(tim - now) > (365/2)*86400) fmt = bsdtar->day_first ? "%d %b %Y" : "%b %d %Y";