]> git.ipfire.org Git - pakfire.git/commitdiff
config: Treat NULL as an empty section
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 14 Jun 2021 09:51:57 +0000 (09:51 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 14 Jun 2021 09:51:57 +0000 (09:51 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/config.c

index 5504aa626714faa979d320968d45547d5c426a2a..b2df62df70ee1bc7bf35327dca50413e6650eabe 100644 (file)
@@ -127,8 +127,14 @@ static struct pakfire_config_entry* pakfire_config_find(struct pakfire_config* c
        struct pakfire_config_entry* entry;
 
        // Check for valid input
-       if (!section || !key)
+       if (!key) {
+               errno = EINVAL;
                return NULL;
+       }
+
+       // Treat NULL as an empty section
+       if (!section)
+               section = "";
 
        STAILQ_FOREACH(entry, &config->entries, nodes) {
                // Section must match