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.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/wcsmbs/wcrtomb.c b/wcsmbs/wcrtomb.c
index c5b887dce9..69c67705c3 100644
--- a/wcsmbs/wcrtomb.c
+++ b/wcsmbs/wcrtomb.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
 
@@ -48,8 +48,10 @@ __wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
 
   if (s == NULL)
     {
-      s = fake;
-      wc = L'\0';
+      /* This is equivalent to wcrtomb (<<internal>, L'\0', ps).  We
+	 only have to reset the state.  */
+      ps->count = 0;
+      return 1;
     }
 
   /* Store the UTF8 representation of WC.  */
@@ -65,6 +67,7 @@ __wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
       /* It's a one byte sequence.  */
       if (s != NULL)
 	*s = (char) wc;
+      ps->count = 0;
       return 1;
     }