summaryrefslogtreecommitdiff
path: root/glib/goption.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2005-06-09 15:39:29 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2005-06-09 15:39:29 +0000
commite90cd618b1ee7282317ac99b6e7739bc0a5570d9 (patch)
tree74f32c5b33569cbe1ecf821afd814a562c75b631 /glib/goption.c
parentf15bb122cec96ec2a7744f276821d65478b5e695 (diff)
downloadglib-e90cd618b1ee7282317ac99b6e7739bc0a5570d9.tar.gz
Set errno to 0 before calling strtol. (#306388, Morten Welinder)
2005-06-09 Matthias Clasen <mclasen@redhat.com> * glib/goption.c (parse_int): Set errno to 0 before calling strtol. (#306388, Morten Welinder)
Diffstat (limited to 'glib/goption.c')
-rw-r--r--glib/goption.c15
1 files changed, 10 insertions, 5 deletions
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')
{