diff options
Diffstat (limited to 'wcsmbs/wcsrtombs.c')
-rw-r--r-- | wcsmbs/wcsrtombs.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/wcsmbs/wcsrtombs.c b/wcsmbs/wcsrtombs.c index b2c0c73778..cc21a51eb3 100644 --- a/wcsmbs/wcsrtombs.c +++ b/wcsmbs/wcsrtombs.c @@ -59,7 +59,12 @@ __wcsrtombs (dst, src, len, ps) while (written < len) { - wchar_t wc = *run++; + wchar_t wc; + + /* Store position of first unprocessed word. */ + *src = run; + + wc = *run++; if (wc < 0 || wc > 0x7fffffff) { @@ -73,6 +78,7 @@ __wcsrtombs (dst, src, len, ps) /* Found the end. */ if (dst != NULL) *dst = '\0'; + ps->count = 0; *src = NULL; return written; } @@ -120,6 +126,9 @@ __wcsrtombs (dst, src, len, ps) /* Store position of first unprocessed word. */ *src = run; + /* Signal that we finished correctly. */ + ps->count = 0; + return written; } weak_alias (__wcsrtombs, wcsrtombs) |