diff osdep/getch2-os2.c @ 29290:ef46d5a66bb2

Use a malloced string for the get_term_charset return value. This is necessary at least on POSIX systems since the buffer returned by nl_langinfo may change its contents with e.g. each setlocale call.
author reimar
date Sun, 31 May 2009 13:00:51 +0000
parents d5d66bff938a
children 32725ca88fed
line wrap: on
line diff
--- a/osdep/getch2-os2.c	Sun May 31 12:48:53 2009 +0000
+++ b/osdep/getch2-os2.c	Sun May 31 13:00:51 2009 +0000
@@ -26,6 +26,7 @@
 #include <os2.h>
 
 #include <stdio.h>
+#include <string.h>
 
 #include "config.h"
 #include "keycodes.h"
@@ -189,7 +190,7 @@
 
 #ifdef HAVE_LANGINFO
     setlocale( LC_CTYPE, "");
-    charset = nl_langinfo( CODESET );
+    charset = strdup( nl_langinfo( CODESET ));
     setlocale( LC_CTYPE, "C");
 #endif