apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: [Fwd: [mp2] coredump strerror code on Solaris 8
Date Thu, 09 Sep 2004 14:07:24 GMT
Joe Orton wrote:
> On Wed, Sep 08, 2004 at 06:18:49PM -0400, Stas Bekman wrote:
> 
>>But normally apr_strerror(500, buf, 256) returns "not specified error" 
>>string or something like that, which is cool. Why does it segfault is what 
>>I can't understand. Notice that it doesn't happen on linux.
> 
> 
> strerror(500) will return NULL on Solaris which APR does not expect (and
> the standards seem to say is wrong behaviour too for what that's worth).

Excellent, Joe. Will it make into 2.0.51?

> This patch should fix the issue, thanks for the report:
> 
> Index: errorcodes.c
> ===================================================================
> RCS file: /home/cvs/apr/misc/unix/errorcodes.c,v
> retrieving revision 1.55.2.2
> diff -u -r1.55.2.2 errorcodes.c
> --- errorcodes.c	13 Feb 2004 09:33:49 -0000	1.55.2.2
> +++ errorcodes.c	9 Sep 2004 08:11:32 -0000
> @@ -372,7 +372,13 @@
>      sprintf(err, "Native Error #%d", statcode);
>      return stuffbuffer(buf, bufsize, err);
>  #else
> -    return stuffbuffer(buf, bufsize, strerror(statcode));
> +    const char *err = strerror(statcode);
> +    if (err) {
> +        return stuffbuffer(buf, bufsize, err);
> +    } else {
> +        return stuffbuffer(buf, bufsize, 
> +                           "APR does not understand this error code");
> +    }
>  #endif
>  }
>  #endif


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Mime
View raw message