]> git.ipfire.org Git - pakfire.git/commitdiff
pakfire: Pass path when reading /etc/os-release
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 18 Oct 2024 12:50:18 +0000 (12:50 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 18 Oct 2024 12:50:18 +0000 (12:50 +0000)
The Pakfire path is not set at this point.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/pakfire.c

index f1a2694e990f27744f060aef9defc5be6f3c053a..c3e36f0ba965c3de9ba1efd5e0361b1a5e709fff 100644 (file)
@@ -635,23 +635,24 @@ static int pakfire_config_import_distro(struct pakfire* pakfire) {
        return 0;
 }
 
-static int pakfire_read_os_release(struct pakfire* pakfire) {
-       char path[PATH_MAX];
+static int pakfire_read_os_release(struct pakfire* pakfire, const char* path) {
+       char file[PATH_MAX];
        int r;
 
        // Compose path
-       r = pakfire_path(pakfire, path, "%s", "/etc/os-release");
+       r = pakfire_path_append(file, path, "/etc/os-release");
        if (r < 0)
                return r;
 
        // Read the distro
-       r = pakfire_distro(&pakfire->distro, path);
+       r = pakfire_distro(&pakfire->distro, file);
        if (r < 0) {
                switch (-r) {
                        case ENOENT:
                                return 0;
 
                        default:
+                               CTX_ERROR(pakfire->ctx, "Could not read /etc/os-release: %s\n", strerror(-r));
                                break;
                }
        }
@@ -838,7 +839,7 @@ PAKFIRE_EXPORT int pakfire_create(struct pakfire** pakfire, struct pakfire_ctx*
 
        // Read /etc/os-release
        if (p->internal_flags & PAKFIRE_HAS_PATH) {
-               r = pakfire_read_os_release(p);
+               r = pakfire_read_os_release(p, path);
                if (r < 0)
                        goto ERROR;