From: Michael Tremer Date: Tue, 17 Oct 2023 08:50:48 +0000 (+0000) Subject: ctx: Ignore if the configuration file does not exist X-Git-Tag: 0.9.30~1476 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f6a10afc72eddcc9606cdaeb7e09ea5b75da677;p=pakfire.git ctx: Ignore if the configuration file does not exist Signed-off-by: Michael Tremer --- 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);