about summary refs log tree commit diff
path: root/wcsmbs/mbsrtowcs.c
diff options
context:
space:
mode:
Diffstat (limited to 'wcsmbs/mbsrtowcs.c')
-rw-r--r--wcsmbs/mbsrtowcs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/wcsmbs/mbsrtowcs.c b/wcsmbs/mbsrtowcs.c
index 7c55fec213..f8c39e69bb 100644
--- a/wcsmbs/mbsrtowcs.c
+++ b/wcsmbs/mbsrtowcs.c
@@ -62,10 +62,14 @@ __mbsrtowcs (dst, src, len, ps)
   /* We have to handle DST == NULL special.  */
   if (dst == NULL)
     {
+      mbstate_t temp_state;
       wchar_t buf[64];		/* Just an arbitrary size.  */
       const unsigned char *inbuf = (const unsigned char *) *src;
       const unsigned char *srcend = inbuf + strlen (inbuf) + 1;
 
+      temp_state = *data.__statep;
+      data.__statep = &temp_state;
+
       result = 0;
       data.__outbufend = (char *) buf + sizeof (buf);
       do