From 255d3c2e14928db5212a845d229298be79211d31 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sat, 15 Apr 2023 20:06:04 -0400 Subject: ustar: Fix seeking --- (limited to 'src/ustar.c') diff --git a/src/ustar.c b/src/ustar.c index 0a508f5..a77dace 100644 --- a/src/ustar.c +++ b/src/ustar.c @@ -132,11 +132,9 @@ opkg_opk_ustar_seek(struct opkg_opk_ustar *ustar, const char *member) { static struct _opkg_opk_ustar_header header; static unsigned char name[OPKG_OPK_USTAR_NAME_MAX_LEN]; - int ret; for (;;) { - if ((ret =_opkg_opk_ustar_next(ustar, &header)) != OPKG_OPK_OK) - { + if (_opkg_opk_ustar_next(ustar, &header) != OPKG_OPK_OK) { return OPKG_OPK_ERROR; /* Error or end (not found) */ } @@ -148,21 +146,19 @@ opkg_opk_ustar_seek(struct opkg_opk_ustar *ustar, const char *member) name[sizeof(header.name)] = '\0'; } - if (strcmp((char *) name, member) == 0) { - ret = OPKG_OPK_OK; /* Member found */ - } else { - ret = OPKG_OPK_ERROR; /* Member not found (yet) */ - } - while (ustar->data_size_remaining > 0) { if (opkg_opk_ustar_read(ustar, NULL, NULL) == OPKG_OPK_ERROR) { return OPKG_OPK_ERROR; } } + + if (strcmp((char *) name, member) == 0) { + return OPKG_OPK_OK; /* Member found */ + } } - return ret; + return OPKG_OPK_ERROR; /* Member not found */ } int -- cgit v0.9.1