From: Michael Tremer Date: Fri, 18 Oct 2024 12:50:18 +0000 (+0000) Subject: pakfire: Pass path when reading /etc/os-release X-Git-Tag: 0.9.30~1018 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ca0de9d75337b0ab3da837a2e153755ce0d59a2a;p=pakfire.git pakfire: Pass path when reading /etc/os-release The Pakfire path is not set at this point. Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/pakfire.c b/src/libpakfire/pakfire.c index f1a2694e9..c3e36f0ba 100644 --- a/src/libpakfire/pakfire.c +++ b/src/libpakfire/pakfire.c @@ -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;