]> git.ipfire.org Git - pakfire.git/commitdiff
repo: Fix writing configuration
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 22 Feb 2025 20:00:41 +0000 (20:00 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 22 Feb 2025 20:00:41 +0000 (20:00 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/repo.c

index 3046596f18ea4b6acd9b9b1b867dcb99f46b8cc7..f087f4e94316cae5d8ba86f5fc875e6496a7245f 100644 (file)
@@ -1776,15 +1776,17 @@ int pakfire_repo_write_config(struct pakfire_repo* repo, FILE* f) {
        }
 
        // Refresh Interval
-       r = pakfire_string_format_interval(refresh, repo->appdata->refresh);
-       if (r < 0)
-               goto ERROR;
+       if (repo->appdata->refresh >= 0) {
+               r = pakfire_string_format_interval(refresh, repo->appdata->refresh);
+               if (r < 0)
+                       goto ERROR;
 
-       // Set the refresh interval
-       r = pakfire_config_set(config, section, "refresh", refresh);
-       if (r < 0) {
-               ERROR(repo->ctx, "Could not set refresh interval: %s\n", strerror(-r));
-               goto ERROR;
+               // Set the refresh interval
+               r = pakfire_config_set(config, section, "refresh", refresh);
+               if (r < 0) {
+                       ERROR(repo->ctx, "Could not set refresh interval: %s\n", strerror(-r));
+                       goto ERROR;
+               }
        }
 
        // Mirror List