summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2009-09-11 14:37:51 +0100
committerRichard Hughes <richard@hughsie.com>2009-09-11 14:39:48 +0100
commit97a782484471b00529471588da6fe54ba8e4c207 (patch)
treeebe7a1bbd32ce1c90e3c067c5b7fd3b5b94d105a /tools
parent2f211aa7a78ab77f3c30bc06eb4740c749b5d333 (diff)
downloadupower-97a782484471b00529471588da6fe54ba8e4c207.tar.gz
Fix up a few problems spotted by clang
Diffstat (limited to 'tools')
-rw-r--r--tools/dkp-tool.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/tools/dkp-tool.c b/tools/dkp-tool.c
index e9d58b2..031e9d5 100644
--- a/tools/dkp-tool.c
+++ b/tools/dkp-tool.c
@@ -193,7 +193,7 @@ out:
int
main (int argc, char **argv)
{
- gint retval = 1;
+ gint retval = EXIT_FAILURE;
guint i;
GOptionContext *context;
gboolean verbose = FALSE;
@@ -245,9 +245,14 @@ main (int argc, char **argv)
goto out;
}
+ /* wakeups */
if (opt_wakeups) {
dkp_tool_show_wakeups ();
- } else if (opt_enumerate || opt_dump) {
+ retval = EXIT_SUCCESS;
+ goto out;
+ }
+
+ if (opt_enumerate || opt_dump) {
GPtrArray *devices;
devices = dkp_client_enumerate_devices (client, &error);
if (devices == NULL) {
@@ -270,10 +275,18 @@ main (int argc, char **argv)
g_print ("Daemon:\n");
dkp_client_print (client);
}
- } else if (opt_monitor || opt_monitor_detail) {
+ retval = EXIT_SUCCESS;
+ goto out;
+ }
+
+ if (opt_monitor || opt_monitor_detail) {
if (!dkp_tool_do_monitor (client))
goto out;
- } else if (opt_show_info != NULL) {
+ retval = EXIT_SUCCESS;
+ goto out;
+ }
+
+ if (opt_show_info != NULL) {
device = dkp_device_new ();
ret = dkp_device_set_object_path (device, opt_show_info, &error);
if (!ret) {
@@ -281,12 +294,11 @@ main (int argc, char **argv)
g_error_free (error);
} else {
dkp_device_print (device);
- retval = 0;
}
g_object_unref (device);
+ retval = EXIT_SUCCESS;
+ goto out;
}
-
- retval = 0;
out:
g_object_unref (client);
return retval;