diff options
| author | Tim J. Robbins <tjr@FreeBSD.org> | 2004-04-07 09:55:05 +0000 |
|---|---|---|
| committer | Tim J. Robbins <tjr@FreeBSD.org> | 2004-04-07 09:55:05 +0000 |
| commit | 93996f6d58e252f9f975d3bc8522df8fe227f002 (patch) | |
| tree | 12c84b3433d9dfe7221d8772b9282c58a3f99811 /lib/libc/stdio/vswscanf.c | |
| parent | e97e8562744f5b6a68d5ee5da07c791c42785e80 (diff) | |
Notes
Diffstat (limited to 'lib/libc/stdio/vswscanf.c')
| -rw-r--r-- | lib/libc/stdio/vswscanf.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/stdio/vswscanf.c b/lib/libc/stdio/vswscanf.c index 128e1a46f238..7b17e2f39779 100644 --- a/lib/libc/stdio/vswscanf.c +++ b/lib/libc/stdio/vswscanf.c @@ -64,6 +64,8 @@ int vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt, va_list ap) { + static const mbstate_t initial; + mbstate_t mbs; FILE f; struct __sFILEX ext; char *mbstr; @@ -76,7 +78,8 @@ vswscanf(const wchar_t * __restrict str, const wchar_t * __restrict fmt, */ if ((mbstr = malloc(wcslen(str) * MB_CUR_MAX + 1)) == NULL) return (EOF); - if ((mlen = wcsrtombs(mbstr, &str, SIZE_T_MAX, NULL)) == (size_t)-1) { + mbs = initial; + if ((mlen = wcsrtombs(mbstr, &str, SIZE_T_MAX, &mbs)) == (size_t)-1) { free(mbstr); return (EOF); } |
