deploy: Correctly swap bootloader version with new boot checksums

If we had two deployments with different boot checksums, and were
trying to remove the one that was the same and add a new one (the
normal case), we'd end up assuming due to comparison with 0 that
we only needed to do the fast subbootversion swap.

Fix this by actually putting 1 where we really mean 1.

And update the tests to verify the fix; I have double-verified by
undoing the fix, and noting that the test fails.

https://bugzilla.gnome.org/show_bug.cgi?id=708351
This commit is contained in:
Colin Walters committed 2013-09-20 11:21:08 -04:00
1 parent 08b8734576
commit 298625d7f8
3 files changed
+18 -17

No files matched your search

+3 -11
View File
@@ -980,18 +980,10 @@ bootcsum_counts_for_deployment_list (GPtrArray *deployments)
{
OstreeDeployment *deployment = deployments->pdata[i];
const char *bootcsum = ostree_deployment_get_bootcsum (deployment);
gpointer orig_key;
gpointer countp;
guint count;
if (!g_hash_table_lookup_extended (ret, bootcsum, &orig_key, &countp))
{
g_hash_table_insert (ret, (char*)bootcsum, GUINT_TO_POINTER (0));
}
else
{
guint count = GPOINTER_TO_UINT (countp);
g_hash_table_replace (ret, (char*)bootcsum, GUINT_TO_POINTER (count + 1));
}
count = GPOINTER_TO_UINT (g_hash_table_lookup (ret, bootcsum));
g_hash_table_replace (ret, (char*)bootcsum, GUINT_TO_POINTER (count + 1));
}
return ret;
}