libxbps: ABI/API break due to hash function changes
This commit is contained in:
@@ -53,7 +53,7 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
char *hash = NULL;
|
||||
char sha256[XBPS_SHA256_SIZE];
|
||||
const char *mode = NULL, *progname = argv[0];
|
||||
const struct option longopts[] = {
|
||||
{ NULL, 0, NULL, 0 }
|
||||
@@ -84,23 +84,19 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (argc < 1) {
|
||||
hash = xbps_file_hash("/dev/stdin");
|
||||
if (hash == NULL)
|
||||
if (!xbps_file_sha256(sha256, sizeof sha256, "/dev/stdin"))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
printf("%s\n", hash);
|
||||
free(hash);
|
||||
printf("%s\n", sha256);
|
||||
} else {
|
||||
for (int i = 0; i < argc; i++) {
|
||||
hash = xbps_file_hash(argv[i]);
|
||||
if (hash == NULL) {
|
||||
if (!xbps_file_sha256(sha256, sizeof sha256, argv[i])) {
|
||||
fprintf(stderr,
|
||||
"%s: couldn't get hash for %s (%s)\n",
|
||||
progname, argv[i], strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("%s\n", hash);
|
||||
free(hash);
|
||||
printf("%s\n", sha256);
|
||||
}
|
||||
}
|
||||
exit(EXIT_SUCCESS);
|
||||
|
Reference in New Issue
Block a user