From: Michael Tremer Date: Wed, 11 Dec 2019 11:21:05 +0000 (+0000) Subject: database: Correctly handle error codes from OpenSSL X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=498aad1500a2d909d70d0b2d371f3bee1cccc0b5;p=people%2Fsennis%2Flibloc.git database: Correctly handle error codes from OpenSSL Signed-off-by: Michael Tremer --- diff --git a/src/database.c b/src/database.c index 933f1c5..fcf40a0 100644 --- a/src/database.c +++ b/src/database.c @@ -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();