From 79a5c739a45bff3ad53f9d1d88fa9bba1f7e581c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 15 Mar 2006 13:03:48 +0000 Subject: [PATCH] Only set the prgname if it hasn't been set before. (#334611, Chong Kai 2006-03-15 Matthias Clasen * glib/goption.c (g_option_context_parse): Only set the prgname if it hasn't been set before. (#334611, Chong Kai Xiong) --- ChangeLog | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-12 | 5 +++++ glib/goption.c | 23 ++++++++++++----------- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48a7e3d..ec42ab7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-03-15 Matthias Clasen + + * glib/goption.c (g_option_context_parse): Only set the prgname + if it hasn't been set before. (#334611, Chong Kai Xiong) + 2006-03-14 Matthias Clasen * glib/gutils.c (g_parse_debug_string): Don't read past the diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 48a7e3d..ec42ab7 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2006-03-15 Matthias Clasen + + * glib/goption.c (g_option_context_parse): Only set the prgname + if it hasn't been set before. (#334611, Chong Kai Xiong) + 2006-03-14 Matthias Clasen * glib/gutils.c (g_parse_debug_string): Don't read past the diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 48a7e3d..ec42ab7 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +2006-03-15 Matthias Clasen + + * glib/goption.c (g_option_context_parse): Only set the prgname + if it hasn't been set before. (#334611, Chong Kai Xiong) + 2006-03-14 Matthias Clasen * glib/gutils.c (g_parse_debug_string): Don't read past the diff --git a/glib/goption.c b/glib/goption.c index 40ce662..73809e6 100644 --- a/glib/goption.c +++ b/glib/goption.c @@ -1232,19 +1232,20 @@ g_option_context_parse (GOptionContext *context, GList *list; /* Set program name */ - if (argc && argv && *argc) + if (!g_get_prgname()) { - gchar *prgname; - - prgname = g_path_get_basename ((*argv)[0]); - g_set_prgname (prgname); - g_free (prgname); - } - else - { - g_set_prgname (""); + if (argc && argv && *argc) + { + gchar *prgname; + + prgname = g_path_get_basename ((*argv)[0]); + g_set_prgname (prgname); + g_free (prgname); + } + else + g_set_prgname (""); } - + /* Call pre-parse hooks */ list = context->groups; while (list) -- 2.7.4