From owner-p4-projects@FreeBSD.ORG Thu Jul 31 15:08:26 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A259F1065677; Thu, 31 Jul 2008 15:08:26 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 665991065672 for ; Thu, 31 Jul 2008 15:08:26 +0000 (UTC) (envelope-from strauss@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 58D458FC13 for ; Thu, 31 Jul 2008 15:08:26 +0000 (UTC) (envelope-from strauss@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m6VF8QeV097496 for ; Thu, 31 Jul 2008 15:08:26 GMT (envelope-from strauss@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m6VF8QUD097494 for perforce@freebsd.org; Thu, 31 Jul 2008 15:08:26 GMT (envelope-from strauss@FreeBSD.org) Date: Thu, 31 Jul 2008 15:08:26 GMT Message-Id: <200807311508.m6VF8QUD097494@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to strauss@FreeBSD.org using -f From: Anselm Strauss To: Perforce Change Reviews Cc: Subject: PERFORCE change 146324 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2008 15:08:27 -0000 http://perforce.freebsd.org/chv.cgi?CH=146324 Change 146324 by strauss@strauss_marvelman on 2008/07/31 15:07:29 Setting archive errors before returning failures (not sure about the error numbers) Affected files ... .. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_set_format_zip.c#22 edit Differences ... ==== //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_set_format_zip.c#22 (text+ko) ==== @@ -155,8 +155,10 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) { /* TODO: Also handle non-regular file entries. */ - if (archive_entry_filetype(entry) != AE_IFREG) + if (archive_entry_filetype(entry) != AE_IFREG) { + archive_set_error(&a->archive, EPERM, "Non-regular files are not yet supported."); return ARCHIVE_FAILED; + }; struct zip *zip; struct zip_local_file_header h; @@ -207,11 +209,17 @@ zip_encode(size, &d->uncompressed_size, sizeof(d->uncompressed_size)); ret = (a->compressor.write)(a, &h, sizeof(h)); - if (ret != ARCHIVE_OK) return (ARCHIVE_FATAL); + if (ret != ARCHIVE_OK) { + archive_set_error(&a->archive, EIO, "Can't write local file header"); + return (ARCHIVE_FATAL); + } zip->written_bytes += sizeof(h); ret = (a->compressor.write)(a, path, strlen(path)); - if (ret != ARCHIVE_OK) return (ARCHIVE_FATAL); + if (ret != ARCHIVE_OK) { + archive_set_error(&a->archive, EIO, "Can't write path field"); + return (ARCHIVE_FATAL); + } zip->written_bytes += strlen(path); return (ARCHIVE_OK); @@ -228,6 +236,7 @@ zip->written_bytes += s; return (s); } else { + archive_set_error(&a->archive, EIO, "Error while writing ZIP data"); return (ret); } @@ -244,11 +253,13 @@ struct zip_data_descriptor *d = &zip->data_descriptor; ret = (a->compressor.write)(a, d, sizeof(*d)); - if (ret != ARCHIVE_OK) + if (ret != ARCHIVE_OK) { + archive_set_error(&a->archive, EIO, "Can't write data descriptor"); return (ARCHIVE_FATAL); + } zip->written_bytes += sizeof(*d); - return (ret); + return (ARCHIVE_OK); } static int @@ -296,12 +307,18 @@ /* Writing file header. */ ret = (a->compressor.write)(a, &h, sizeof(h)); - if (ret != ARCHIVE_OK) return (ARCHIVE_FATAL); + if (ret != ARCHIVE_OK) { + archive_set_error(&a->archive, EIO, "Can't write file header"); + return (ARCHIVE_FATAL); + } zip->written_bytes += sizeof(h); /* Writing filename. */ ret = (a->compressor.write)(a, path, strlen(path)); - if (ret != ARCHIVE_OK) return (ARCHIVE_FATAL); + if (ret != ARCHIVE_OK) { + archive_set_error(&a->archive, EIO, "Can't write path field"); + return (ARCHIVE_FATAL); + } zip->written_bytes += strlen(path); l = l->next; @@ -319,7 +336,10 @@ /* Writing end of central directory. */ ret = (a->compressor.write)(a, &end, sizeof(end)); - if (ret != ARCHIVE_OK) return (ARCHIVE_FATAL); + if (ret != ARCHIVE_OK) { + archive_set_error(&a->archive, EIO, "Can't write end of central directory"); + return (ARCHIVE_FATAL); + } zip->written_bytes += sizeof(end); return (ARCHIVE_OK);