]> git.ipfire.org Git - pakfire.git/commitdiff
ctx: Ignore if the configuration file does not exist
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Oct 2023 08:50:48 +0000 (08:50 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Oct 2023 08:50:48 +0000 (08:50 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/ctx.c

index 58c9c41ab42e00321bc32c88dc9606b69b75b187..83ddb409371c403c4f802654ac34146121cd8fdc 100644 (file)
@@ -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);