apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject cvs commit: apr/misc/unix errorcodes.c
Date Thu, 09 Sep 2004 15:22:31 GMT
jorton      2004/09/09 08:22:31

  Modified:    test     Tag: APR_0_9_BRANCH teststr.c
               misc/unix Tag: APR_0_9_BRANCH errorcodes.c
  Log:
  * misc/unix/errorcodes.c (native_strerror): Gracefully handle
  strerror() returning NULL on Solaris.
  
  * test/teststr.c (string_error): Throw some randomish numbers at
  apr_strerror to check for robustness.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.16.2.4  +6 -0      apr/test/teststr.c
  
  Index: teststr.c
  ===================================================================
  RCS file: /home/cvs/apr/test/teststr.c,v
  retrieving revision 1.16.2.3
  retrieving revision 1.16.2.4
  diff -d -w -u -r1.16.2.3 -r1.16.2.4
  --- teststr.c	27 Jun 2004 11:45:11 -0000	1.16.2.3
  +++ teststr.c	9 Sep 2004 15:22:31 -0000	1.16.2.4
  @@ -163,6 +163,7 @@
   static void string_error(CuTest *tc)
   {
        char buf[128], *rv;
  +     apr_status_t n;
   
        buf[0] = '\0';
        rv = apr_strerror(APR_ENOENT, buf, sizeof buf);
  @@ -172,6 +173,11 @@
        rv = apr_strerror(APR_TIMEUP, buf, sizeof buf);
        CuAssertPtrEquals(tc, buf, rv);
        CuAssertStrEquals(tc, "The timeout specified has expired", buf);
  +     
  +     /* throw some randomish numbers at it to check for robustness */
  +     for (n = 1; n < 1000000; n *= 2) {
  +         apr_strerror(n, buf, sizeof buf);
  +     }
   }
   
   #define SIZE 180000
  
  
  
  No                   revision
  No                   revision
  1.55.2.3  +7 -1      apr/misc/unix/errorcodes.c
  
  Index: errorcodes.c
  ===================================================================
  RCS file: /home/cvs/apr/misc/unix/errorcodes.c,v
  retrieving revision 1.55.2.2
  retrieving revision 1.55.2.3
  diff -d -w -u -r1.55.2.2 -r1.55.2.3
  --- errorcodes.c	13 Feb 2004 09:33:49 -0000	1.55.2.2
  +++ errorcodes.c	9 Sep 2004 15:22:31 -0000	1.55.2.3
  @@ -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
  
  
  

Mime
View raw message