From e90cd618b1ee7282317ac99b6e7739bc0a5570d9 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 9 Jun 2005 15:39:29 +0000 Subject: [PATCH] Set errno to 0 before calling strtol. (#306388, Morten Welinder) 2005-06-09 Matthias Clasen * glib/goption.c (parse_int): Set errno to 0 before calling strtol. (#306388, Morten Welinder) --- ChangeLog | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-12 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ glib/goption.c | 15 ++++++++++----- 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0a4efe81d..c433fbeda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-06-09 Matthias Clasen + + * glib/goption.c (parse_int): Set errno to 0 before calling + strtol. (#306388, Morten Welinder) + 2005-06-09 Tor Lillqvist * glib/gstdio.h diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 0a4efe81d..c433fbeda 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +2005-06-09 Matthias Clasen + + * glib/goption.c (parse_int): Set errno to 0 before calling + strtol. (#306388, Morten Welinder) + 2005-06-09 Tor Lillqvist * glib/gstdio.h diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 0a4efe81d..c433fbeda 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +2005-06-09 Matthias Clasen + + * glib/goption.c (parse_int): Set errno to 0 before calling + strtol. (#306388, Morten Welinder) + 2005-06-09 Tor Lillqvist * glib/gstdio.h diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 0a4efe81d..c433fbeda 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +2005-06-09 Matthias Clasen + + * glib/goption.c (parse_int): Set errno to 0 before calling + strtol. (#306388, Morten Welinder) + 2005-06-09 Tor Lillqvist * glib/gstdio.h diff --git a/glib/goption.c b/glib/goption.c index 60303c517..4f2d2b6ca 100644 --- a/glib/goption.c +++ b/glib/goption.c @@ -33,18 +33,22 @@ #define TRANSLATE(group, str) (((group)->translate_func ? (* (group)->translate_func) ((str), (group)->translate_data) : (str))) -typedef struct { +typedef struct +{ GOptionArg arg_type; gpointer arg_data; - union { + union + { gboolean bool; gint integer; gchar *str; gchar **array; } prev; - union { + union + { gchar *str; - struct { + struct + { gint len; gchar **data; } array; @@ -628,9 +632,10 @@ parse_int (const gchar *arg_name, GError **error) { gchar *end; - glong tmp = strtol (arg, &end, 0); + glong tmp; errno = 0; + tmp = strtol (arg, &end, 0); if (*arg == '\0' || *end != '\0') { -- 2.34.1