From: Jonathan Lebon Date: Wed, 28 Feb 2018 17:30:18 +0000 (+0000) Subject: lib/sysroot: Fix retrieving non-booted pending deployment X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~4^2~25^2~39 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=530043fcf6444f5751caa2c478d9411ab78e1698;p=ostree.git lib/sysroot: Fix retrieving non-booted pending deployment If we're booted into a deployment, then any queries for the pending merge deployment of a non-booted OS will fail due all of them being considered rollback. Fix this by filtering by `osname` *before* determining if we've crossed the booted deployment yet. Closes: #1472 Approved by: cgwalters --- diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index 2c12b78b..2d12deb6 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -1202,6 +1202,10 @@ ostree_sysroot_query_deployments_for (OstreeSysroot *self, { OstreeDeployment *deployment = self->deployments->pdata[i]; + /* Ignore deployments not for this osname */ + if (strcmp (ostree_deployment_get_osname (deployment), osname) != 0) + continue; + /* Is this deployment booted? If so, note we're past the booted */ if (self->booted_deployment != NULL && ostree_deployment_equal (deployment, self->booted_deployment)) @@ -1210,10 +1214,6 @@ ostree_sysroot_query_deployments_for (OstreeSysroot *self, continue; } - /* Ignore deployments not for this osname */ - if (strcmp (ostree_deployment_get_osname (deployment), osname) != 0) - continue; - if (!found_booted && !ret_pending) ret_pending = g_object_ref (deployment); else if (found_booted && !ret_rollback)