Skip to content

Commit

Permalink
Merge pull request #2496 from lucab/ups/repo-asserts
Browse files Browse the repository at this point in the history
lib/repo: fix problematic invariant checks
  • Loading branch information
cgwalters authored Dec 8, 2021
2 parents 490f515 + 58bdfb9 commit b56786c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/libostree/ostree-repo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1558,8 +1558,10 @@ gboolean
ostree_repo_is_writable (OstreeRepo *self,
GError **error)
{
g_return_val_if_fail (self->inited, FALSE);
g_assert (self != NULL);
g_assert (self->inited);

g_assert (self->writable == (self->writable_error == NULL));
if (error != NULL && self->writable_error != NULL)
*error = g_error_copy (self->writable_error);

Expand Down Expand Up @@ -1595,7 +1597,8 @@ _ostree_repo_update_mtime (OstreeRepo *self,
GKeyFile *
ostree_repo_get_config (OstreeRepo *self)
{
g_return_val_if_fail (self->inited, NULL);
g_assert (self != NULL);
g_assert (self->inited);

return self->config;
}
Expand All @@ -1613,7 +1616,8 @@ ostree_repo_copy_config (OstreeRepo *self)
char *data;
gsize len;

g_return_val_if_fail (self->inited, NULL);
g_assert (self != NULL);
g_assert (self->inited);

copy = g_key_file_new ();
data = g_key_file_to_data (self->config, &len, NULL);
Expand Down Expand Up @@ -3812,7 +3816,8 @@ ostree_repo_equal (OstreeRepo *a,
OstreeRepoMode
ostree_repo_get_mode (OstreeRepo *self)
{
g_return_val_if_fail (self->inited, FALSE);
g_assert (self != NULL);
g_assert (self->inited);

return self->mode;
}
Expand Down

0 comments on commit b56786c

Please sign in to comment.