deploy: Ensure boot directory is open before accessing it
authorRogerio Guerra Borin <rogerio.borin@toradex.com>
Tue, 12 Mar 2024 20:02:58 +0000 (17:02 -0300)
committerRogerio Guerra Borin <rogerio.borin@toradex.com>
Tue, 12 Mar 2024 20:29:35 +0000 (17:29 -0300)
This fixes a bug in the (early) deployment pruning function which before
tried to access the boot directory without opening it first.

Signed-off-by: Rogerio Guerra Borin <rogerio.borin@toradex.com>
src/libostree/ostree-sysroot-deploy.c

index 5d2d729bf01bd95ebb7c5569041c6e14351e6cdd..f777b92f0d70db2dc32d9c7bcb1cfd111cda0670 100644 (file)
@@ -2641,6 +2641,9 @@ auto_early_prune_old_deployments (OstreeSysroot *self, GPtrArray *new_deployment
   if (self->booted_deployment == NULL)
     return TRUE;
 
+  if (!_ostree_sysroot_ensure_boot_fd (self, error))
+    return FALSE;
+
   {
     struct stat stbuf;
     if (!glnx_fstatat (self->boot_fd, ".", &stbuf, 0, error))