]> the.earth.li Git - onak.git/commitdiff
Make DB4 backend quieter when num_keydb file is missing main
authorJonathan McDowell <noodles@earth.li>
Fri, 31 Oct 2025 19:05:59 +0000 (19:05 +0000)
committerJonathan McDowell <noodles@earth.li>
Fri, 31 Oct 2025 19:05:59 +0000 (19:05 +0000)
This file tells us how many DB4 files we're sharding across for actual
key storage. If it's not found, we create it. Only log an error if it's
not that the file doesn't exist.

keydb/keydb_db4.c

index 35fcdd1cd1913817197b5ebf0bc8a74e582e342c..2b970ad1403bf2d623269ef3d07f9119ffe37ad8 100644 (file)
@@ -1489,9 +1489,10 @@ struct onak_dbctx *keydb_db4_init(struct onak_db_config *dbcfg, bool readonly)
                        privctx->numdbs = atoi(buf);
                }
                fclose(numdb);
-       } else if (!readonly) {
+       } else if (errno != ENOENT) {
                logthing(LOGTHING_ERROR, "Couldn't open num_keydb: %s",
                                strerror(errno));
+       } else if (!readonly) {
                numdb = fopen(buf, "w");
                if (numdb != NULL) {
                        fprintf(numdb, "%d", privctx->numdbs);