about summary refs log tree commit diff
path: root/wcsmbs/wcrtomb.c
diff options
context:
space:
mode:
Diffstat (limited to 'wcsmbs/wcrtomb.c')
-rw-r--r--wcsmbs/wcrtomb.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/wcsmbs/wcrtomb.c b/wcsmbs/wcrtomb.c
index 43a2162500..2703e88a36 100644
--- a/wcsmbs/wcrtomb.c
+++ b/wcsmbs/wcrtomb.c
@@ -24,19 +24,25 @@ Boston, MA 02111-1307, USA.  */
 #define EILSEQ EINVAL
 #endif
 
+
+static mbstate_t internal;
+
 size_t
 wcrtomb (s, wc, ps)
      char *s;
      wchar_t wc;
      mbstate_t *ps;
 {
+  char fake[1];
+
+  if (ps == NULL)
+    ps = internal;
+
   /*************************************************************\
   |* This is no complete implementation.  While the multi-byte *|
   |* character handling is not finished this will do.	       *|
   \*************************************************************/
 
-  char fake[1];
-
   if (s == NULL)
     {
       s = fake;