]> git.ipfire.org Git - pakfire.git/commitdiff
repo: Fix string formatting
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 9 Oct 2024 15:09:16 +0000 (15:09 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 9 Oct 2024 15:14:22 +0000 (15:14 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/repo.c

index 108a07b86b509aa06c4487c5088caa2955905d14..7cfa6afc53a2323455ba28f60e72e459400ad184 100644 (file)
@@ -1158,17 +1158,21 @@ PAKFIRE_EXPORT int pakfire_repo_write_config(struct pakfire_repo* repo, FILE* f)
                        goto ERROR;
                }
 
-               r = pakfire_config_set_format(config, section, "key", "%.*s", (int)length, buffer);
-               if (r) {
-                       ERROR(repo->pakfire, "Could not set key: %m\n");
-                       goto ERROR;
+#warning Are we actually exporting the key here?
+
+               if (buffer) {
+                       r = pakfire_config_set_format(config, section, "key", "%.*s", (int)length, buffer);
+                       if (r) {
+                               ERROR(repo->pakfire, "Could not set key: %m\n");
+                               goto ERROR;
+                       }
                }
        }
 
        // Priority
        unsigned int priority = pakfire_repo_get_priority(repo);
        if (priority) {
-               r = pakfire_config_set_format(config, section, "priority", "%d", priority);
+               r = pakfire_config_set_format(config, section, "priority", "%u", priority);
                if (r) {
                        ERROR(repo->pakfire, "Could not set priority: %m\n");
                        goto ERROR;