xbps-repo: genindex: optimization change.
While looking at the archive for the XBPS_PKGPROPS file, it's unlikely that it will have it after reading 6 entries, so discard it completely and show an error message. The XBPS_PKGPROPS it's always there at index <= 4. --HG-- extra : convert_revision : xtraeme%40gmail.com-20091125001733-i46wnqdxp497km6s
This commit is contained in:
parent
00c458fca1
commit
2693e54ef6
@ -90,7 +90,7 @@ xbps_repo_addpkg_index(prop_dictionary_t idxdict, const char *filedir,
|
||||
struct stat st;
|
||||
const char *pkgname, *version, *regver, *oldfilen;
|
||||
char *sha256, *filen, *tmpfilen, *tmpstr, *oldfilepath;
|
||||
int rv = 0;
|
||||
int i = 0, rv = 0;
|
||||
|
||||
if (idxdict == NULL || file == NULL)
|
||||
return EINVAL;
|
||||
@ -128,8 +128,19 @@ xbps_repo_addpkg_index(prop_dictionary_t idxdict, const char *filedir,
|
||||
* into a buffer.
|
||||
*/
|
||||
while (archive_read_next_header(ar, &entry) == ARCHIVE_OK) {
|
||||
if (i >= 5) {
|
||||
/*
|
||||
* Unlikely that archive contains XBPS_PKGPROPS,
|
||||
* discard it completely.
|
||||
*/
|
||||
archive_read_data_skip(ar);
|
||||
printf("W: archive %s does not contain required "
|
||||
"props.plist file!\n", file);
|
||||
break;
|
||||
}
|
||||
if (strstr(archive_entry_pathname(entry), XBPS_PKGPROPS) == 0) {
|
||||
archive_read_data_skip(ar);
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
newpkgd = xbps_read_dict_from_archive_entry(ar, entry);
|
||||
|
Loading…
Reference in New Issue
Block a user