[gnome-utils] [gsearchtool] Properly handle invalid command line args
- From: Dennis Cranston <dcransto src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-utils] [gsearchtool] Properly handle invalid command line args
- Date: Wed, 30 Sep 2009 14:50:12 +0000 (UTC)
commit 085f4970baa0c249ad052121beeadeaf6d03c9e6
Author: Dennis Cranston <dennis_cranston yahoo com>
Date: Wed Sep 30 07:47:06 2009 -0700
[gsearchtool] Properly handle invalid command line args
gsearchtool/ChangeLog | 5 +++++
gsearchtool/gsearchtool.c | 11 +++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/gsearchtool/ChangeLog b/gsearchtool/ChangeLog
index f2a28cf..af456dc 100644
--- a/gsearchtool/ChangeLog
+++ b/gsearchtool/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-29 Dennis Cranston <dennis_cranston yahoo com>
+
+ * gsearchtool.c: Properly handle invalid command line
+ arguments.
+
2009-09-28 Dennis Cranston <dennis_cranston yahoo com>
* gsearchtool-callbacks.c: Fix possible crash after
diff --git a/gsearchtool/gsearchtool.c b/gsearchtool/gsearchtool.c
index fdbadcd..1d02d21 100644
--- a/gsearchtool/gsearchtool.c
+++ b/gsearchtool/gsearchtool.c
@@ -2961,7 +2961,8 @@ main (int argc,
{
GSearchWindow * gsearch;
GOptionContext * context;
- GtkWidget * window;
+ GtkWidget * window;
+ GError * error = NULL;
EggSMClient * client;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
@@ -2974,7 +2975,13 @@ main (int argc,
g_option_context_add_main_entries (context, GSearchGOptionEntries, GETTEXT_PACKAGE);
g_option_context_add_group (context, gtk_get_option_group (TRUE));
g_option_context_add_group (context, egg_sm_client_get_option_group ());
- g_option_context_parse (context, &argc, &argv, NULL);
+ g_option_context_parse (context, &argc, &argv, &error);
+
+ if (error) {
+ g_printerr (_("Failed to parse command line arguments: %s\n"), error->message);
+ return (-1);
+ }
+
g_option_context_free (context);
g_set_application_name (_("Search for Files"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]