From ed2e6c08147e3ac27aef0af7ac1db6c1657746fd Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Mon, 12 Jan 2009 11:45:52 +0000 Subject: [PATCH] Guard against a mis-written GOptionArgFunc that has returned FALSE but not 2009-01-12 Tor Lillqvist * glib/goption.c (parse_arg): Guard against a mis-written GOptionArgFunc that has returned FALSE but not set the GError. svn path=/trunk/; revision=7804 --- ChangeLog | 5 +++++ glib/goption.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index e58ffbdc6..3cd3a501a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-01-12 Tor Lillqvist + + * glib/goption.c (parse_arg): Guard against a mis-written + GOptionArgFunc that has returned FALSE but not set the GError. + 2009-01-10 Matthias Clasen Bug 566573 – g_match_info_fetch_pos docs diff --git a/glib/goption.c b/glib/goption.c index e5bd2bad0..fa39b793b 100644 --- a/glib/goption.c +++ b/glib/goption.c @@ -1150,6 +1150,11 @@ parse_arg (GOptionContext *context, retval = (* (GOptionArgFunc) entry->arg_data) (option_name, data, group->user_data, error); + if (!retval && error != NULL && *error == NULL) + g_set_error (error, + G_OPTION_ERROR, G_OPTION_ERROR_FAILED, + _("Error parsing option %s"), option_name); + g_free (data); return retval;