Date: Sun, 06 Apr 2014 01:10:25 +0200
Fair enough. This is the response I got from UK Customer Support. The
MAXERRSTR_SIZE might have been available in previous versions of
VxWorks, I don't know, but it's not anymore. I think the comment should
be updated to at least reflect why a 256 byte buffer should be used, but
that's just my opinion. I just thought I'd let you guys know.
----- quote -----
I will be assisting on this question.
You don't say what OS/ compiler version you are using so I will show the
method as well as the answer....
Looking at vxWorks 6.9.3 the code for strerror_r (kernel version) is
located in target/src/libc/strerror.c
There we also see the descriptive comment block:
* strerror_r - map an error number to an error string
* This routine maps the error number in <errcode> to an error message
* It stores the error string in <buffer>. The size of <buffer> should
* NAME_MAX + 1 - using a smaller buffer may lead to stack corruption.
* is defined in limits.h.
And some further searching shows
#define NAME_MAX _PARM_NAME_MAX /* max filename length excluding
#define _PARM_NAME_MAX 255
Therefore the maximum length will be 256.
It is also possible to get this by examining the code:
int errcode, /* error code */
char * buffer /* string buffer */
char * str;
if (buffer == NULL)
str = strerrorIf (errcode);
if (str != NULL)
strlcpy (buffer, str, (size_t) NAME_MAX + 1);
snprintf (buffer, (size_t) NAME_MAX + 1, "errno = %#x",
Where we clearly see the NAME_MAX+1 restriction on the strlcpy and
You should be able to apply the same techniques to whatever version you
have presuming you have source code. If you don't I can look if you
tell me the precise OS version & whether this is for kernel or RTP.
Please reply to say if this answer your question.
----- /quote -----
On Sat, 2014-04-05 at 22:37 +0200, Daniel Stenberg wrote:
> On Sat, 5 Apr 2014, Jeroen Koekkoek wrote:
> > In your strerror function in cURL there is a quote that states the buffer
> > should be 150 bytes on VxWorks, this quote is incorrect. A buffer of 256 is
> > used, which is correct. You might want to update the quote. Please see
> > http://stackoverflow.com/questions/22856387/maximum-size-of-message-for-strerror-r-on-vxworks
> > for details.
> You referring to your own question and your own answer on stackoverflow is not
> a reliable source. This change was brought by a person who built and used
> libcurl on vxworks back in 2009.
> Also, please use the curl-library mailing list for libcurl discussions.
> / daniel.haxx.se
List admin: http://cool.haxx.se/list/listinfo/curl-library
Received on 2014-04-06