Fix g_strerror() on non-glibc

When using one of the codepaths that copies the error string into buf,
make sure the string gets strdup() afterward.

https://bugzilla.gnome.org/show_bug.cgi?id=758194
This commit is contained in:
Dan Winship 2015-11-16 16:57:38 -05:00
parent 03cb2eb088
commit f87e002313

View File

@ -1293,6 +1293,8 @@ g_strerror (gint errnum)
if (error) if (error)
g_print ("%s\n", error->message); g_print ("%s\n", error->message);
} }
else if (msg == (const gchar *)buf)
msg = g_strdup (buf);
g_hash_table_insert (errors, GINT_TO_POINTER (errnum), (char *) msg); g_hash_table_insert (errors, GINT_TO_POINTER (errnum), (char *) msg);
} }