lib/bootloader: assert invariants
This tweaks some invariants checks into full assertions, in order to avoid returning to the caller in case of known invalid states.
This commit is contained in:
parent
eed9e9f335
commit
273089d9e4
|
|
@ -73,7 +73,7 @@ ostree_bootconfig_parser_parse_at (OstreeBootconfigParser *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (!self->parsed, FALSE);
|
g_assert (!self->parsed);
|
||||||
|
|
||||||
g_autofree char *contents = glnx_file_get_contents_utf8_at (dfd, path, NULL, cancellable, error);
|
g_autofree char *contents = glnx_file_get_contents_utf8_at (dfd, path, NULL, cancellable, error);
|
||||||
if (!contents)
|
if (!contents)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ _ostree_bootloader_query (OstreeBootloader *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (OSTREE_IS_BOOTLOADER (self), FALSE);
|
g_assert (OSTREE_IS_BOOTLOADER (self));
|
||||||
|
|
||||||
return OSTREE_BOOTLOADER_GET_IFACE (self)->query (self, out_is_active, cancellable, error);
|
return OSTREE_BOOTLOADER_GET_IFACE (self)->query (self, out_is_active, cancellable, error);
|
||||||
}
|
}
|
||||||
|
|
@ -44,7 +44,7 @@ _ostree_bootloader_query (OstreeBootloader *self,
|
||||||
const char *
|
const char *
|
||||||
_ostree_bootloader_get_name (OstreeBootloader *self)
|
_ostree_bootloader_get_name (OstreeBootloader *self)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (OSTREE_IS_BOOTLOADER (self), NULL);
|
g_assert (OSTREE_IS_BOOTLOADER (self));
|
||||||
|
|
||||||
return OSTREE_BOOTLOADER_GET_IFACE (self)->get_name (self);
|
return OSTREE_BOOTLOADER_GET_IFACE (self)->get_name (self);
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +56,7 @@ _ostree_bootloader_write_config (OstreeBootloader *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (OSTREE_IS_BOOTLOADER (self), FALSE);
|
g_assert (OSTREE_IS_BOOTLOADER (self));
|
||||||
|
|
||||||
return OSTREE_BOOTLOADER_GET_IFACE (self)->write_config (self, bootversion,
|
return OSTREE_BOOTLOADER_GET_IFACE (self)->write_config (self, bootversion,
|
||||||
new_deployments,
|
new_deployments,
|
||||||
|
|
@ -69,7 +69,7 @@ _ostree_bootloader_post_bls_sync (OstreeBootloader *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (OSTREE_IS_BOOTLOADER (self), FALSE);
|
g_assert (OSTREE_IS_BOOTLOADER (self));
|
||||||
|
|
||||||
if (OSTREE_BOOTLOADER_GET_IFACE (self)->post_bls_sync)
|
if (OSTREE_BOOTLOADER_GET_IFACE (self)->post_bls_sync)
|
||||||
return OSTREE_BOOTLOADER_GET_IFACE (self)->post_bls_sync (self, bootversion, cancellable, error);
|
return OSTREE_BOOTLOADER_GET_IFACE (self)->post_bls_sync (self, bootversion, cancellable, error);
|
||||||
|
|
@ -80,7 +80,7 @@ _ostree_bootloader_post_bls_sync (OstreeBootloader *self,
|
||||||
gboolean
|
gboolean
|
||||||
_ostree_bootloader_is_atomic (OstreeBootloader *self)
|
_ostree_bootloader_is_atomic (OstreeBootloader *self)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (OSTREE_IS_BOOTLOADER (self), FALSE);
|
g_assert (OSTREE_IS_BOOTLOADER (self));
|
||||||
|
|
||||||
if (OSTREE_BOOTLOADER_GET_IFACE (self)->is_atomic)
|
if (OSTREE_BOOTLOADER_GET_IFACE (self)->is_atomic)
|
||||||
return OSTREE_BOOTLOADER_GET_IFACE (self)->is_atomic (self);
|
return OSTREE_BOOTLOADER_GET_IFACE (self)->is_atomic (self);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue