]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
database: Correctly handle error codes from OpenSSL
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 11 Dec 2019 11:21:05 +0000 (11:21 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 11 Dec 2019 11:21:05 +0000 (11:21 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/database.c

index 933f1c5d6c79ad622cdf068a8342f6fd672d39fe..fcf40a03ced81ab55a022b6b2112a08b9fe68950 100644 (file)
@@ -503,12 +503,15 @@ LOC_EXPORT int loc_database_verify(struct loc_database* db, FILE* f) {
                (unsigned char*)db->signature, db->signature_length);
 
        if (r == 0) {
-               DEBUG(db->ctx, "The signature is valid\n");
-       } else if (r == 1) {
                DEBUG(db->ctx, "The signature is invalid\n");
+               r = 1;
+       } else if (r == 1) {
+               DEBUG(db->ctx, "The signature is valid\n");
+               r = 0;
        } else {
                ERROR(db->ctx, "Error verifying the signature: %s\n",
                        ERR_error_string(ERR_get_error(), NULL));
+               r = 1;
        }
 
        clock_t end = clock();