From: Tor Lillqvist Date: Mon, 12 Jan 2009 11:45:52 +0000 (+0000) Subject: Guard against a mis-written GOptionArgFunc that has returned FALSE but not X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=ed2e6c08147e3ac27aef0af7ac1db6c1657746fd;p=dana%2Fcg-glib.git 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 --- diff --git a/ChangeLog b/ChangeLog index e58ffbdc..3cd3a501 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 e5bd2bad..fa39b793 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;