From: David VaĊĦek Date: Fri, 20 Mar 2020 14:25:15 +0000 (+0100) Subject: kjournalprint: report an error on nonexistent or unrecognised DB when listing zones X-Git-Tag: embedded_lmdb~35^2~114 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a51fa2023d84b7587f69718eaa0d1370dce9ce3;p=thirdparty%2Fknot-dns.git kjournalprint: report an error on nonexistent or unrecognised DB when listing zones At the same time, fix the wrong return value from journals_walk(). --- diff --git a/src/knot/journal/journal_metadata.c b/src/knot/journal/journal_metadata.c index 9cca8cb9f6..b97edd8a83 100644 --- a/src/knot/journal/journal_metadata.c +++ b/src/knot/journal/journal_metadata.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 CZ.NIC, z.s.p.o. +/* Copyright (C) 2020 CZ.NIC, z.s.p.o. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -360,7 +360,7 @@ int journal_info(zone_journal_t j, bool *exists, uint32_t *first_serial, bool *h int journals_walk(knot_lmdb_db_t *db, journals_walk_cb_t cb, void *ctx) { if (!knot_lmdb_exists(db)) { - return KNOT_EOK; + return KNOT_EFILE; } int ret = knot_lmdb_open(db); if (ret != KNOT_EOK) { diff --git a/src/utils/kjournalprint/main.c b/src/utils/kjournalprint/main.c index a9140a974d..7b304efada 100644 --- a/src/utils/kjournalprint/main.c +++ b/src/utils/kjournalprint/main.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 CZ.NIC, z.s.p.o. +/* Copyright (C) 2020 CZ.NIC, z.s.p.o. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -315,6 +315,9 @@ int main(int argc, char *argv[]) // FALLTHROUGH case KNOT_EOK: return EXIT_SUCCESS; + case KNOT_EFILE: + fprintf(stderr, "The specified journal DB is invalid\n"); + return EXIT_FAILURE; case KNOT_EMALF: fprintf(stderr, "The journal DB is broken\n"); return EXIT_FAILURE;