From: Michael Tremer Date: Sun, 29 Jun 2025 14:51:32 +0000 (+0000) Subject: root: Rename pakfire_root_on_root to pakfire_root_is_root X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=a264130bbed78eea353079c6f913d553462bae2e;p=pakfire.git root: Rename pakfire_root_on_root to pakfire_root_is_root Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/jail.c b/src/pakfire/jail.c index 328d8bc2..0398b5d4 100644 --- a/src/pakfire/jail.c +++ b/src/pakfire/jail.c @@ -252,7 +252,7 @@ int pakfire_jail_create(pakfire_jail** jail, pakfire_ctx* ctx, pakfire_root* roo goto ERROR; // Disable systemctl to talk to systemd - if (!pakfire_root_on_root(self->root)) { + if (!pakfire_root_is_root(self->root)) { r = pakfire_env_set(self->env, "SYSTEMD_OFFLINE", "1"); if (r < 0) goto ERROR; @@ -1558,7 +1558,7 @@ static int pakfire_jail_child(pakfire_jail* jail, pakfire_jail_exec* ctx) { return r; // Change root (unless root is /) - if (!pakfire_root_on_root(jail->root)) { + if (!pakfire_root_is_root(jail->root)) { // Mount everything r = pakfire_jail_mount(jail, ctx); if (r) diff --git a/src/pakfire/root.c b/src/pakfire/root.c index 9fc7b0e0..24537733 100644 --- a/src/pakfire/root.c +++ b/src/pakfire/root.c @@ -151,7 +151,7 @@ static const char* features[] = { NULL, }; -int pakfire_root_on_root(pakfire_root* self) { +int pakfire_root_is_root(pakfire_root* self) { return (strcmp(self->path, "/") == 0); } @@ -178,7 +178,7 @@ const struct pakfire_subid* pakfire_root_subgid(pakfire_root* self) { static unsigned int pakfire_root_map_id(pakfire_root* self, const struct pakfire_subid* subid, const unsigned int id) { // Nothing to do if we are running on root - if (pakfire_root_on_root(self)) + if (pakfire_root_is_root(self)) return id; // Map the ID @@ -196,7 +196,7 @@ static unsigned int pakfire_root_map_id(pakfire_root* self, static unsigned int pakfire_root_unmap_id(pakfire_root* self, const struct pakfire_subid* subid, const unsigned int id) { // Nothing to do if we are running on root - if (pakfire_root_on_root(self)) + if (pakfire_root_is_root(self)) return id; // Unmap the ID @@ -382,7 +382,7 @@ static int pakfire_root_setup_pool(pakfire_root* self) { } // Lock the running kernel - if (pakfire_root_on_root(self)) { + if (pakfire_root_is_root(self)) { r = pakfire_root_lock_running_kernel(self); if (r < 0) return r; @@ -533,7 +533,7 @@ static void pakfire_root_free(pakfire_root* self) { // Safety check in case this is being launched on the host system static int pakfire_root_safety_checks(pakfire_root* self) { // Nothing to do if we are not working on root - if (!pakfire_root_on_root(self)) + if (!pakfire_root_is_root(self)) return 0; // We must be root in order to operate in / @@ -940,7 +940,7 @@ static int pakfire_root_setup_user(pakfire_root* self) { self->user.subuids.length = self->group.subgids.length = 1; // Read SUBUID/SUBGIDs from file - if (!pakfire_root_on_root(self)) { + if (!pakfire_root_is_root(self)) { // Fetch SUBUIDs r = pakfire_getsubuid(self->ctx, self, self->user.name, &self->user.subuids); switch (r) { diff --git a/src/pakfire/root.h b/src/pakfire/root.h index 725bb908..c19498f5 100644 --- a/src/pakfire/root.h +++ b/src/pakfire/root.h @@ -94,7 +94,7 @@ int pakfire_root_update_snapshot(pakfire_root* pakfire); const char* pakfire_root_get_effective_arch(pakfire_root* pakfire); -int pakfire_root_on_root(pakfire_root* pakfire); +int pakfire_root_is_root(pakfire_root* pakfire); uid_t pakfire_root_uid(pakfire_root* pakfire); gid_t pakfire_root_gid(pakfire_root* pakfire);