lib/repo: do no return an arbitrary mode on failure
authorLuca BRUNO <luca.bruno@coreos.com>
Tue, 7 Dec 2021 16:16:39 +0000 (16:16 +0000)
committerLuca BRUNO <luca.bruno@coreos.com>
Tue, 7 Dec 2021 16:23:02 +0000 (16:23 +0000)
This turns the existing check into an assert. Otherwise, the previous
code may return an arbitrary repo mode (bare) on failure.

src/libostree/ostree-repo.c

index 85700b03abd609c03a4d70d1690b9d7e1e04a87e..f07d223508f5c326340fffbe809a8334510f0cb8 100644 (file)
@@ -3816,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;
 }