apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject cvs commit: apr/test teststr.c
Date Thu, 09 Sep 2004 15:42:02 GMT
jorton      2004/09/09 08:42:02

  Modified:    misc/unix errorcodes.c
               test     teststr.c
  Log:
  As per 0.9 branch:
  
  * 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
  1.59      +7 -1      apr/misc/unix/errorcodes.c
  
  Index: errorcodes.c
  ===================================================================
  RCS file: /home/cvs/apr/misc/unix/errorcodes.c,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -d -w -u -r1.58 -r1.59
  --- errorcodes.c	13 Feb 2004 09:38:32 -0000	1.58
  +++ errorcodes.c	9 Sep 2004 15:42:01 -0000	1.59
  @@ -374,7 +374,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
  
  
  
  1.27      +6 -0      apr/test/teststr.c
  
  Index: teststr.c
  ===================================================================
  RCS file: /home/cvs/apr/test/teststr.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -d -w -u -r1.26 -r1.27
  --- teststr.c	26 Jul 2004 15:21:59 -0000	1.26
  +++ teststr.c	9 Sep 2004 15:42:02 -0000	1.27
  @@ -150,6 +150,7 @@
   static void string_error(abts_case *tc, void *data)
   {
        char buf[128], *rv;
  +     apr_status_t n;
   
        buf[0] = '\0';
        rv = apr_strerror(APR_ENOENT, buf, sizeof buf);
  @@ -159,6 +160,11 @@
        rv = apr_strerror(APR_TIMEUP, buf, sizeof buf);
        ABTS_PTR_EQUAL(tc, buf, rv);
        ABTS_STR_EQUAL(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
  
  
  

Mime
View raw message