Maximum size of message for strerror_r on VxWorks
Asked Answered
A

1

2

VxWorks provides a version of strerror_r that only takes two parameters.

STATUS strerror_r
(
    int errcode, /* error number */
    char *buffer /* string buffer */
)

cURL mentions MAXERRSTR_SIZE.

The vxworks-style strerror_r() does use the buffer we pass to the function. The buffer size should be at least MAXERRSTR_SIZE (150) defined in rtsold.h

But I can't seem to find the file rtsold.h anywhere in the distribution.

What is the maximum size of the message copied into the buffer? Is there a #define or integer constant defined somewhere?

Annulation answered 4/4, 2014 at 7:33 Comment(1)
The text you quote actually tells you the size.Plowshare
A
2

For future reference. The maximum size is NAME_MAX, or 255 bytes at the time of this writing. Keep in mind the termination byte, and pass a buffer of at least 256 bytes to be safe. (It seems I could have just consulted the source for strerror_r on VxWorks. I'm sorry, I didn't know that).

Annulation answered 5/4, 2014 at 20:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.