components/gnome/glib2/patches/14-gstrerror.patch
author Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
Sat, 13 Aug 2016 23:42:23 -0700
changeset 6614 ff27f2901f5d
permissions -rw-r--r--
24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6614
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     1
Fix from upstream git for:
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     2
Bug 24458406 - g_strerror caches and tries to reuse a pointer to a stack buffer
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     3
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     4
Included in later 2.48 release upstream.
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     5
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     6
From f87e002313d566dcce71a9aba040d22ddb5c1e80 Mon Sep 17 00:00:00 2001
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     7
From: Dan Winship <[email protected]>
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     8
Date: Mon, 16 Nov 2015 16:57:38 -0500
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
     9
Subject: [PATCH] Fix g_strerror() on non-glibc
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    10
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    11
When using one of the codepaths that copies the error string into buf,
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    12
make sure the string gets strdup() afterward.
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    13
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    14
https://bugzilla.gnome.org/show_bug.cgi?id=758194
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    15
---
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    16
 glib/gstrfuncs.c | 2 ++
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    17
 1 file changed, 2 insertions(+)
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    18
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    19
diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    20
index b5a862b..975be0b 100644
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    21
--- a/glib/gstrfuncs.c
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    22
+++ b/glib/gstrfuncs.c
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    23
@@ -1293,6 +1293,8 @@ g_strerror (gint errnum)
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    24
           if (error)
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    25
             g_print ("%s\n", error->message);
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    26
         }
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    27
+      else if (msg == (const gchar *)buf)
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    28
+        msg = g_strdup (buf);
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    29
 
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    30
       g_hash_table_insert (errors, GINT_TO_POINTER (errnum), (char *) msg);
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    31
     }
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    32
-- 
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    33
2.7.4
ff27f2901f5d 24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff changeset
    34