From 9f6a10afc72eddcc9606cdaeb7e09ea5b75da677 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 17 Oct 2023 08:50:48 +0000 Subject: [PATCH] ctx: Ignore if the configuration file does not exist Signed-off-by: Michael Tremer --- src/libpakfire/ctx.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/libpakfire/ctx.c b/src/libpakfire/ctx.c index 58c9c41ab..83ddb4093 100644 --- a/src/libpakfire/ctx.c +++ b/src/libpakfire/ctx.c @@ -120,14 +120,24 @@ static int pakfire_ctx_load_config(struct pakfire_ctx* ctx, const char* path) { FILE* f = NULL; int r; +#warning HARD-CODED CONFIGURATION FILE PATH + // Load some default configuration if not path was provided if (!path) path = "/etc/pakfire/pakfire.conf"; // Open the configuration file f = fopen(path, "r"); - if (!f) - return -errno; + if (!f) { + switch (errno) { + // Ignore if the file does not exist + case ENOENT: + return 0; + + default: + return -errno; + } + } // Read the configuration file r = pakfire_config_read(ctx->config, f); -- 2.47.3