[ostree] ostree admin: Fix return value from 'ostree admin [instutil]'
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] ostree admin: Fix return value from 'ostree admin [instutil]'
- Date: Thu, 25 Sep 2014 18:29:53 +0000 (UTC)
commit 40f490ed11febb72182b125c67a86b5f634211b6
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Tue Sep 23 11:58:27 2014 -0400
ostree admin: Fix return value from 'ostree admin [instutil]'
'ostree admin' and 'ostree admin instuil' with no arguments were meant to fail,
but the logic was wrong; add an assertion on the return value from all ostree
commands to catch similar problems in the future.
https://bugzilla.gnome.org/show_bug.cgi?id=737194
src/ostree/ot-admin-builtin-instutil.c | 8 +++++++-
src/ostree/ot-builtin-admin.c | 8 +++++++-
src/ostree/ot-main.c | 10 +++++++++-
3 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/src/ostree/ot-admin-builtin-instutil.c b/src/ostree/ot-admin-builtin-instutil.c
index 0a6bb31..66ea80e 100644
--- a/src/ostree/ot-admin-builtin-instutil.c
+++ b/src/ostree/ot-admin-builtin-instutil.c
@@ -127,7 +127,13 @@ ot_admin_builtin_instutil (int argc, char **argv, OstreeSysroot *sysroot, GCance
g_print (" %s\n", subcommand->name);
subcommand++;
}
- return subcommand_name == NULL ? 1 : 0;
+
+ if (want_help)
+ ret = TRUE;
+ else
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "No command specified");
+ goto out;
}
subcommand = admin_instutil_subcommands;
diff --git a/src/ostree/ot-builtin-admin.c b/src/ostree/ot-builtin-admin.c
index f7dce93..6db97ca 100644
--- a/src/ostree/ot-builtin-admin.c
+++ b/src/ostree/ot-builtin-admin.c
@@ -155,7 +155,13 @@ ostree_builtin_admin (int argc, char **argv, OstreeRepo *repo, GCancellable *can
g_print (" %s\n", subcommand->name);
subcommand++;
}
- return subcommand_name == NULL ? 1 : 0;
+
+ if (want_help)
+ ret = TRUE;
+ else
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "No command specified");
+ goto out;
}
subcommand = admin_subcommands;
diff --git a/src/ostree/ot-main.c b/src/ostree/ot-main.c
index 1dfa93d..6adb2d2 100644
--- a/src/ostree/ot-main.c
+++ b/src/ostree/ot-main.c
@@ -83,6 +83,7 @@ ostree_run (int argc,
const char *repo_arg = NULL;
gboolean want_help = FALSE;
gboolean skip;
+ gboolean success = FALSE;
int in, out, i;
/* avoid gvfs (http://bugzilla.gnome.org/show_bug.cgi?id=526454) */
@@ -191,7 +192,11 @@ ostree_run (int argc,
if (cmd == NULL)
{
- if (!want_help)
+ if (want_help)
+ {
+ success = TRUE;
+ }
+ else
{
g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED,
"No command specified");
@@ -252,7 +257,10 @@ ostree_run (int argc,
if (!command->fn (argc, argv, repo, cancellable, &error))
goto out;
+ success = TRUE;
out:
+ g_assert (success || error);
+
if (error)
{
g_propagate_error (res_error, error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]