svn commit: r190960 - head/lib/libarchive

Tim Kientzle kientzle at FreeBSD.org
Sun Apr 12 05:38:36 UTC 2009


Author: kientzle
Date: Sun Apr 12 05:38:35 2009
New Revision: 190960
URL: http://svn.freebsd.org/changeset/base/190960

Log:
  Thanks to Christoph Mallon for pointing out the dead variable here.
  Also, rework this a little to make the logic excruciatingly clear.

Modified:
  head/lib/libarchive/archive_read_support_format_empty.c

Modified: head/lib/libarchive/archive_read_support_format_empty.c
==============================================================================
--- head/lib/libarchive/archive_read_support_format_empty.c	Sun Apr 12 05:33:34 2009	(r190959)
+++ head/lib/libarchive/archive_read_support_format_empty.c	Sun Apr 12 05:38:35 2009	(r190960)
@@ -59,13 +59,14 @@ archive_read_support_format_empty(struct
 static int
 archive_read_format_empty_bid(struct archive_read *a)
 {
-	const void *h;
 	ssize_t avail;
 
-	h = __archive_read_ahead(a, 1, &avail);
-	if (avail != 0)
-		return (-1);
-	return (1);
+	(void)__archive_read_ahead(a, 1, &avail);
+	/* Bid 1 if we successfully read exactly zero bytes. */
+	if (avail == 0)
+		return (1);
+	/* Otherwise, we don't bid on this. */
+	return (-1);
 }
 
 static int


More information about the svn-src-head mailing list