Addition of the new errno values requires adding new elements to sys_errlist array, which is actually ABI-incompatible, since ELF records the object size. Expand array in advance to 150 elements so that we have to go over the issue only once.
Details
I checked that perror(1) printed expected strings for negative, normal errno, and errnos 96, 97, 149, 150, 151 in C and ru_RU.KOI8-R locales.
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
lib/libc/string/strerror.c | ||
---|---|---|
55 ↗ | (On Diff #52313) | Not directly related to your change, but I don't think this is/was correct -- if we have NLS enabled, and catalog for current language has the 32767 (0xffff) entry corresponding to "unknown error", and that text is longer than we calculate here, and the num is big enough, the resulting message will be truncated. I understand that it's really too much "if"s, just noting that errstr() likely should just allocate the buffer big enough instead; that is (20 + 2 + strlen(uprefix) + 1). |
lib/libc/string/strerror.c | ||
---|---|---|
55 ↗ | (On Diff #52313) | Err, that comment got me confused, we don't actually copy the uprefix to tmp, right? So we don't need to reserve the space for __uprefix there? |
lib/libc/string/strerror.c | ||
---|---|---|
55 ↗ | (On Diff #52313) | It seems we don't do that now. It was changed in r108603, 2003. |
lib/libc/string/strerror.c | ||
---|---|---|
52 ↗ | (On Diff #52317) | Sorry for making you do the unrelated change.. I think this should now read based on what we actually write into tmp: Define buffer big enough to contain delimiter (": ", 2 bytes), 64-bit signed integer converted to ASCII decimal (19 bytes) with optional leading sign (1 byte), and a trailing NUL. The definition of EBUFSIZE should be 23 then according to the above. |
lib/libc/string/strerror.c | ||
---|---|---|
52 ↗ | (On Diff #52317) | Well, num is int which is 32-bit value and not 64-bit, on any supported architecture. That said, lets pretend that we would support ILP64 or larger arch one day. |