warc: Simplify __archive_read_ahead check
A short read would lead to a NULL return value, thus the second check will never be true. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
This commit is contained in:
1 parent
da33bf2d71
commit
d78fea3815
1 file changed
+1
-4
@@ -192,12 +192,9 @@ _warc_bid(struct archive_read *a, int best_bid)
|
||||
(void)best_bid; /* UNUSED */
|
||||
|
||||
/* Check the first line, which should already be a record header. */
|
||||
if ((hdr = __archive_read_ahead(a, 12U, &nrd)) == NULL) {
|
||||
if ((hdr = __archive_read_ahead(a, 12, &nrd)) == NULL) {
|
||||
/* Not enough data to identify this format. */
|
||||
return -1;
|
||||
} else if (nrd < 12) {
|
||||
/* Not WARC; the magic string is at least 12 bytes. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Parse the record version number. */
|
||||
|
||||
Reference in new issue
Block a user