explicitly mention that NULL is allowed as second argument
in the description part as well.
PR/46618: Onno van der Linden: realpath(3) isn't SUSv4 compliant (and causes
flactag 2.0.4 to dump core). Fix to accept a NULL argument for resolvedpath.
retrieve and return if there has been a conversion error, so that
it can keep performing char-by-char processing if a multi-byte
conversion occurred. Also some more code cleanups in the "extra"
processing.
- The input loop control that I changed yesterday to:
while (mbslength >= 0) {
There are circumstances where this causes an extra \000 to
be added at the end of some tests. This error was showing
in my own tests here, but I did not notice it yesterday.
(I really need to add my tests to the test suite, catching
every error by eye is hard.) To fix, I've now changed the
code to increment mbslength only if mbslength == 1 to start
with. (Note that this check for "== 1" is why the arg to
strvisx() in vis(1) must be 1, not mbilen.)
- The cast sequence when manually inserting bytes after a
multibyte conversion error:
*src = (wint_t)(u_char)*mbsrc;
is wrong. This is causing problems in the case when an
8859-1 input string is processed in the UTF-8 locale.
It needs to be:
*src = (wint_t)*mbsrc;
Without the (u_char) all the locale mismatch combinations
then work.
- The code:
if (mblength < len)
len = mblength;
needs to be there. It resets len for the single character
input case after we've actually processed two input
characters (c and nextc) because we incremented mbslength
at the start of the loop. Without this code, single
character conversions end up with a \000 or other byte
appended.
the soft float or hard float ABI is being used. However, if there isn't a
FPU that can't be done. So only save/restore them if a FPU is present. When
libc initializes, it does a sysctl to determine if there is a FPU and stores
the result which _setjmp/setjmp uses. If there was a FPU, the magic in the
jmp_buf is changed to reflect that the VFP registers were saved. longjmp uses
the magic to determine if it needs to restore the VFP registers.