From: Michael Tremer Date: Wed, 9 Oct 2024 15:09:16 +0000 (+0000) Subject: repo: Fix string formatting X-Git-Tag: 0.9.30~1108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1041299e67a748a6e2602a7d3b7fd83080b914c6;p=pakfire.git repo: Fix string formatting Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/repo.c b/src/libpakfire/repo.c index 108a07b86..7cfa6afc5 100644 --- a/src/libpakfire/repo.c +++ b/src/libpakfire/repo.c @@ -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;