xbps_file_hash_dictionary: only process exact matches.

This commit is contained in:
Juan RP 2012-06-05 20:22:47 +02:00
parent cc30039c60
commit 84c6850c28

View File

@ -159,12 +159,12 @@ xbps_file_hash_dictionary(prop_dictionary_t d,
while ((obj = prop_object_iterator_next(iter)) != NULL) { while ((obj = prop_object_iterator_next(iter)) != NULL) {
prop_dictionary_get_cstring_nocopy(obj, prop_dictionary_get_cstring_nocopy(obj,
"file", &curfile); "file", &curfile);
if (strstr(file, curfile) == NULL) if (strcmp(file, curfile) == 0) {
continue; /* file matched */
/* file matched */ prop_dictionary_get_cstring_nocopy(obj,
prop_dictionary_get_cstring_nocopy(obj, "sha256", &sha256);
"sha256", &sha256); break;
break; }
} }
prop_object_iterator_release(iter); prop_object_iterator_release(iter);
if (sha256 == NULL) if (sha256 == NULL)
@ -193,8 +193,7 @@ xbps_file_hash_check_dictionary(prop_dictionary_t d,
return -1; /* error */ return -1; /* error */
} }
rv = xbps_file_hash_check(file, sha256d); if ((rv = xbps_file_hash_check(file, sha256d)) == 0)
if (rv == 0)
return 0; /* matched */ return 0; /* matched */
else if (rv == ERANGE || rv == ENOENT) else if (rv == ERANGE || rv == ENOENT)
return 1; /* no match */ return 1; /* no match */