summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-10-14 09:26:41 +0200
committerBastien Nocera <hadess@hadess.net>2013-10-14 10:25:38 +0200
commitfed403c167706febbb261f994a3c0aea39c166ca (patch)
treeb012e19192a2e7fb39407f898fa398fffd039b60 /src
parent6abd4123ef2808d1ff35fe7656922f314e68c9a8 (diff)
downloadupower-fed403c167706febbb261f994a3c0aea39c166ca.tar.gz
daemon: Fix options parsing
If an unknown option was passed to the daemon, it might fail to parse some of the passed options, and not take them into account. For example: "upower -d --timed-exit" would fail to exit Error out when an unknown option is passed.
Diffstat (limited to 'src')
-rw-r--r--src/up-main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/up-main.c b/src/up-main.c
index ba79685..f1d81a2 100644
--- a/src/up-main.c
+++ b/src/up-main.c
@@ -212,7 +212,11 @@ main (gint argc, gchar **argv)
context = g_option_context_new ("upower daemon");
g_option_context_add_main_entries (context, options, NULL);
- g_option_context_parse (context, &argc, &argv, NULL);
+ if (!g_option_context_parse (context, &argc, &argv, &error)) {
+ g_warning ("Failed to parse command-line options: %s", error->message);
+ g_error_free (error);
+ return 1;
+ }
g_option_context_free (context);
/* verbose? */