Return-Path: Delivered-To: apmail-apr-cvs-archive@www.apache.org Received: (qmail 12490 invoked from network); 9 Sep 2004 15:42:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 9 Sep 2004 15:42:31 -0000 Received: (qmail 25088 invoked by uid 500); 9 Sep 2004 15:42:08 -0000 Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 24957 invoked by uid 500); 9 Sep 2004 15:42:06 -0000 Mailing-List: contact cvs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list cvs@apr.apache.org Received: (qmail 24891 invoked by uid 99); 9 Sep 2004 15:42:05 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Date: 9 Sep 2004 15:42:02 -0000 Message-ID: <20040909154202.12128.qmail@minotaur.apache.org> From: jorton@apache.org To: apr-cvs@apache.org Subject: cvs commit: apr/test teststr.c X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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