bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strerror_r(3) used incorrectly


From: Federico Montesino Pouzols
Subject: Re: strerror_r(3) used incorrectly
Date: Tue, 19 Nov 2002 11:35:52 +0100
User-agent: Mutt/1.4i

        Fixed. I hope 2048 bytes is enough for the error string :).

        Curiously, the strerror_r of glibc 2.2.4 returns a char*, and
recent versions of autoconf define the STRERROR_R_CHAR_P symbol if you
check for AC_FUNC_STRERROR_R and strerror_r returns char*. So, it
seems that your patch saves us a check for the strerror_r return type
:)

On Mon, Nov 18, 2002 at 09:43:44PM -0600, Ari Johnson wrote:
> 
> See included patch.  Note that my code assumes that that allocated
> 2048-byte buffer is large enough for any error string.  strerror_r(3) will
> return 0 in this case, or will return ERANGE if not enough space was
> available in the buffer.  As IOException::getSystemErrorString() is
> declared throw(), I didn't see a better way to deal with the ERANGE
> possibility other than wild assumption (although it really does seem a
> valid assumption to me).
> 
> This patch is against the current CVS HEAD (21:45 CST, Nov 18)
> 
> Ari Johnson
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]