[Toybox] [PATCH] Fix wc -m on bionic.

enh enh at google.com
Fri Aug 4 17:54:19 PDT 2017


When mbrtowc returns -2, all n bytes have been processed. Bionic's
interpretation of POSIX is that you must not re-supply those bytes
on the next call, and should only supply the bytes needed to complete
the character. If you re-supply the bytes on the next call, bionic
considers that an illegal sequence and returns -1.

With these changes, the tests still pass on glibc and also pass on bionic.
---
 tests/wc.test   |  7 +------
 toys/posix/wc.c | 34 ++++++++++++++--------------------
 2 files changed, 15 insertions(+), 26 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-wc-m-on-bionic.patch
Type: text/x-patch
Size: 3227 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20170804/5c66d247/attachment-0002.bin>


More information about the Toybox mailing list