HomeFreeBSD

strfmon: Fix negative sign handling for C locale

Description

strfmon: Fix negative sign handling for C locale

If the locale's positive_sign and negative_sign values would both be
returned by localeconv() as empty strings, strfmon() shall behave as if
the negative_sign value was the string "-".

This occurs with the C locale. The implementation previously assigned
"0" to sign_posn (parentheses around the entire string); now it assigns
it to "1" (sign before the string) when it is undefined (CHAR_MAX).

Austin Group Defect 1199[1] is applied, changing the requirements for
the '+' and '(' flags.

[1]: https://www.austingroupbugs.net/view.php?id=1199

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D53913

(cherry picked from commit cf85e7034ad5640b18a3b68d6b291b7bf89bfc80)

Details

Provenance
jlduranAuthored on Wed, Nov 26, 8:34 PM
Reviewer
kib
Differential Revision
D53913: strfmon: Fix negative sign handling for C locale
Parents
rG6b0e99570fa2: strfmon: EINVAL if the '+' flag and both signs are empty
Branches
Unknown
Tags
Unknown