sysroot: Also maintain canonical boot_fd
Just like we hold a fd for `/sysroot`, also do so for `/boot` instead of opening and closing it in a few places. This is a preparatory cleanup for further work.
This commit is contained in:
1 parent
10556a95b4
commit
a1c0cffeb3
3 files changed
+34
-17
No files matched your search
@@ -198,6 +198,7 @@ ostree_sysroot_init (OstreeSysroot *self)
|
||||
keys, G_N_ELEMENTS (keys));
|
||||
|
||||
self->sysroot_fd = -1;
|
||||
self->boot_fd = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -278,6 +279,19 @@ ensure_sysroot_fd (OstreeSysroot *self,
|
||||
&self->sysroot_fd, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_ostree_sysroot_ensure_boot_fd (OstreeSysroot *self, GError **error)
|
||||
{
|
||||
if (self->boot_fd == -1)
|
||||
{
|
||||
if (!glnx_opendirat (self->sysroot_fd, "boot", TRUE,
|
||||
&self->boot_fd, error))
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -380,6 +394,7 @@ void
|
||||
ostree_sysroot_unload (OstreeSysroot *self)
|
||||
{
|
||||
glnx_close_fd (&self->sysroot_fd);
|
||||
glnx_close_fd (&self->boot_fd);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user