]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
libpakfire: digest: Use better return codes
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 25 Jul 2023 12:01:33 +0000 (12:01 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 25 Jul 2023 12:58:49 +0000 (12:58 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/digest.c

index 3cd5717ead9e4cee816bfd3ee930547c15171415..7149c27ba0ac1625b621ccb4c40653b2889886bf 100644 (file)
@@ -228,9 +228,7 @@ static int pakfire_digests_check_length(struct pakfire* pakfire,
 
        // Otherwise set an error
        ERROR(pakfire, "Digest is of an unexpected length\n");
-       errno = ENOMSG;
-
-       return 1;
+       return -ENOMSG;
 }
 
 static EVP_MD_CTX* __pakfire_digest_setup(struct pakfire* pakfire, const EVP_MD* md) {
@@ -479,10 +477,8 @@ int pakfire_digests_compare(struct pakfire* pakfire, const struct pakfire_digest
        int r;
 
        // Check if we are at least comparing one type
-       if (!types) {
-               errno = EINVAL;
-               return 1;
-       }
+       if (!types)
+               return -EINVAL;
 
        // Check SHA-3-512
        if (types & PAKFIRE_DIGEST_SHA3_512) {