]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
kjournalprint: report an error on nonexistent or unrecognised DB when listing zones
authorDavid Vašek <david.vasek@nic.cz>
Fri, 20 Mar 2020 14:25:15 +0000 (15:25 +0100)
committerDaniel Salzman <daniel.salzman@nic.cz>
Sun, 22 Mar 2020 20:59:23 +0000 (21:59 +0100)
At the same time, fix the wrong return value from journals_walk().

src/knot/journal/journal_metadata.c
src/utils/kjournalprint/main.c

index 9cca8cb9f6bf4e17614441531d15268ac7486bc6..b97edd8a834d85097602ae2f600c35895e659516 100644 (file)
@@ -1,4 +1,4 @@
-/*  Copyright (C) 2019 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/*  Copyright (C) 2020 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
 
     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) {
index a9140a974d40d4ab2da7f17733a11a87ba75e5d8..7b304efadaf547a3ed743a1212a5449e06f5c098 100644 (file)
@@ -1,4 +1,4 @@
-/*  Copyright (C) 2019 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/*  Copyright (C) 2020 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
 
     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;