summaryrefslogtreecommitdiff
path: root/src/ostree/ot-admin-builtin-undeploy.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2017-04-14 10:26:35 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2017-04-19 14:41:00 +0000
commit0d8cd2f0770501fb454a00a5d47ad2d53977f65a (patch)
tree751ee39f18b4419f13d86560eb92e7c966692324 /src/ostree/ot-admin-builtin-undeploy.c
parentd197bfd1331d68a4eac5d1e0dbf7215fb29d8eb3 (diff)
downloadostree-0d8cd2f0770501fb454a00a5d47ad2d53977f65a.tar.gz
cmdline: Start conversion to new code style
This is just a few. I'm tempted to try out the coccinelle patch for this. Closes: #793 Approved by: jlebon
Diffstat (limited to 'src/ostree/ot-admin-builtin-undeploy.c')
-rw-r--r--src/ostree/ot-admin-builtin-undeploy.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/ostree/ot-admin-builtin-undeploy.c b/src/ostree/ot-admin-builtin-undeploy.c
index cc86ee43..4bf41d0c 100644
--- a/src/ostree/ot-admin-builtin-undeploy.c
+++ b/src/ostree/ot-admin-builtin-undeploy.c
@@ -35,7 +35,6 @@ static GOptionEntry options[] = {
gboolean
ot_admin_builtin_undeploy (int argc, char **argv, GCancellable *cancellable, GError **error)
{
- gboolean ret = FALSE;
g_autoptr(GOptionContext) context = NULL;
glnx_unref_object OstreeSysroot *sysroot = NULL;
const char *deploy_index_str;
@@ -48,16 +47,16 @@ ot_admin_builtin_undeploy (int argc, char **argv, GCancellable *cancellable, GEr
if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER,
&sysroot, cancellable, error))
- goto out;
+ return FALSE;
if (argc < 2)
{
ot_util_usage_error (context, "INDEX must be specified", error);
- goto out;
+ return FALSE;
}
if (!ostree_sysroot_load (sysroot, cancellable, error))
- goto out;
+ return FALSE;
current_deployments = ostree_sysroot_get_deployments (sysroot);
deploy_index_str = argv[1];
@@ -65,31 +64,26 @@ ot_admin_builtin_undeploy (int argc, char **argv, GCancellable *cancellable, GEr
target_deployment = ot_admin_get_indexed_deployment (sysroot, deploy_index, error);
if (!target_deployment)
- goto out;
+ return FALSE;
if (target_deployment == ostree_sysroot_get_booted_deployment (sysroot))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
"Cannot undeploy currently booted deployment %i", deploy_index);
- goto out;
+ return FALSE;
}
-
+
g_ptr_array_remove_index (current_deployments, deploy_index);
if (!ostree_sysroot_write_deployments (sysroot, current_deployments,
cancellable, error))
- goto out;
+ return FALSE;
g_print ("Deleted deployment %s.%d\n", ostree_deployment_get_csum (target_deployment),
ostree_deployment_get_deployserial (target_deployment));
-
+
if (!ostree_sysroot_cleanup (sysroot, cancellable, error))
- {
- g_prefix_error (error, "Performing final cleanup: ");
- goto out;
- }
+ return g_prefix_error (error, "Performing final cleanup: "), FALSE;
- ret = TRUE;
- out:
- return ret;
+ return TRUE;
}