From b3851dec99e3e262f53a2b7acfdfeb67208ee75e Mon Sep 17 00:00:00 2001 From: Misaki Kasumi Date: Sun, 22 Dec 2024 16:26:27 +0800 Subject: [PATCH] sysroot: Fix _ostree_sysroot_ensure_writable --- src/libostree/ostree-sysroot.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index 01597c9b33..668d2c8f5b 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -586,8 +586,11 @@ _ostree_sysroot_ensure_writable (OstreeSysroot *self, GError **error) if (!ensure_sysroot_fd (self, error)) return FALSE; - if (!_ostree_sysroot_ensure_boot_fd (self, error)) - return FALSE; + glnx_autofd int old_sysroot_fd = g_steal_fd (&self->sysroot_fd); + if ((self->sysroot_fd = (int)syscall (SYS_open_tree, old_sysroot_fd, "sysroot", 1 /* OPEN_TREE_CLONE */ | O_CLOEXEC)) < 0) + return glnx_throw_errno_prefix (error, "open_tree"); + if ((self->boot_fd = (int)syscall (SYS_open_tree, old_sysroot_fd, "boot", 1 /* OPEN_TREE_CLONE */ | O_CLOEXEC)) < 0) + return glnx_throw_errno_prefix (error, "open_tree"); /* Switch back */ if (in_root)