summaryrefslogtreecommitdiff
path: root/src/ostree/ot-admin-builtin-set-origin.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2021-03-17 14:03:49 +0000
committerColin Walters <walters@verbum.org>2021-03-17 19:55:56 +0000
commit1b28e6041c33b3f1508dda458ed7ed97aed4375e (patch)
treed9e3f69b61865bc037d97c1ea22d54fd3a72f786 /src/ostree/ot-admin-builtin-set-origin.c
parentd522f261db7e4c2379fe79a18c083426858fc355 (diff)
downloadostree-1b28e6041c33b3f1508dda458ed7ed97aed4375e.tar.gz
sysroot: Add _require_booted_deployment() API
This is a common pattern that is replicated both in our code and in rpm-ostree a lot. Let's add a canonical API.
Diffstat (limited to 'src/ostree/ot-admin-builtin-set-origin.c')
-rw-r--r--src/ostree/ot-admin-builtin-set-origin.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/ostree/ot-admin-builtin-set-origin.c b/src/ostree/ot-admin-builtin-set-origin.c
index 4dc68a00..b133dc58 100644
--- a/src/ostree/ot-admin-builtin-set-origin.c
+++ b/src/ostree/ot-admin-builtin-set-origin.c
@@ -75,13 +75,9 @@ ot_admin_builtin_set_origin (int argc, char **argv, OstreeCommandInvocation *inv
if (opt_index == -1)
{
- target_deployment = ostree_sysroot_get_booted_deployment (sysroot);
+ target_deployment = ostree_sysroot_require_booted_deployment (sysroot, error);
if (target_deployment == NULL)
- {
- g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Not currently booted into an OSTree system");
- goto out;
- }
+ goto out;
/* To match the below */
target_deployment = g_object_ref (target_deployment);
}