diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2023-04-15 20:06:04 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2023-04-15 20:06:04 (EDT) |
commit | 255d3c2e14928db5212a845d229298be79211d31 (patch) | |
tree | 7aa4ea4f726707f437cc6f6815d70b584da46763 /src | |
parent | b3ddcf966c9489c33edf03ff7a02b0de5faef4f0 (diff) |
ustar: Fix seeking
Diffstat (limited to 'src')
-rw-r--r-- | src/ustar.c | 16 |
1 files changed, 6 insertions, 10 deletions
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 |