aboutsummaryrefslogtreecommitdiff
path: root/wcsmbs
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-12-26 19:02:29 +0000
committerUlrich Drepper <drepper@redhat.com>2008-12-26 19:02:29 +0000
commitbf93cd3b8d6643977078c4b67facc0bbb85b03be (patch)
tree07f2bdd1b9a3957f3ba86d861d6ffaf6f17abe9f /wcsmbs
parentf38113e1b9e25ec998f48b6c2efaabbcf5dd4317 (diff)
downloadglibc-bf93cd3b8d6643977078c4b67facc0bbb85b03be.tar
glibc-bf93cd3b8d6643977078c4b67facc0bbb85b03be.tar.gz
glibc-bf93cd3b8d6643977078c4b67facc0bbb85b03be.tar.bz2
glibc-bf93cd3b8d6643977078c4b67facc0bbb85b03be.zip
[BZ #9677]
2008-12-21 Bruno Haible <bruno@clisp.org> [BZ #9677] * wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Create temporary state object if no output is written.
Diffstat (limited to 'wcsmbs')
-rw-r--r--wcsmbs/mbsnrtowcs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/wcsmbs/mbsnrtowcs.c b/wcsmbs/mbsnrtowcs.c
index 8d0b9d3609..a5329a2331 100644
--- a/wcsmbs/mbsnrtowcs.c
+++ b/wcsmbs/mbsnrtowcs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2000, 2002, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2000, 2002, 2005, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@@ -79,9 +79,13 @@ __mbsnrtowcs (dst, src, nmc, 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;
+ temp_state = *data.__statep;
+ data.__statep = &temp_state;
+
result = 0;
data.__outbufend = (unsigned char *) buf + sizeof (buf);
do