You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/04/14 12:28:30 UTC

svn commit: r764729 - in /commons/sandbox/runtime/trunk/src/main/native: configure shared/error.c

Author: mturk
Date: Tue Apr 14 10:28:30 2009
New Revision: 764729

URL: http://svn.apache.org/viewvc?rev=764729&view=rev
Log:
Add test for strerror_r

Modified:
    commons/sandbox/runtime/trunk/src/main/native/configure
    commons/sandbox/runtime/trunk/src/main/native/shared/error.c

Modified: commons/sandbox/runtime/trunk/src/main/native/configure
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=764729&r1=764728&r2=764729&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/configure (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure Tue Apr 14 10:28:30 2009
@@ -408,6 +408,31 @@
     echo $rc
 }
 
+have_strerror_r()
+{
+    printf "Checking for %-32s" "strerror_r" 1>&2
+    cat > $test.c << EOF
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+int main() {char b[256]; strerror_r(1, b, sizeof(b)); return 0;}
+EOF
+    rc="0"
+    co="`$cc $ccflags $cppopts $test.c -o $test$exe 2>&1`"
+    if [ -x $test$exe ]; then
+        ./$test$exe
+        rv=$?
+        if [ ".$rv" = ".0" ]; then rc="1"; fi
+    fi
+    rm -rf $test.* $test *.pdb >/dev/null 2>&1 || true
+    if [ $rc = 1 ]; then
+        echo ok 1>&2
+    else
+        echo "not found" 1>&2
+    fi
+    echo $rc
+}
+
 test_csizeof()
 {
     printf "Checking for sizeof %-25s" "$1" 1>&2
@@ -462,6 +487,7 @@
 #define HAVE_WTYPE_H          `have_include wctype`
 #define HAVE_AIO_H            `have_include aio`
 #define HAVE_NETDB_H          `have_include netdb`
+#define HAVE_STRERROR_R       `have_strerror_r`
 
 #define HAS_BIG_ENDIAN        $bige
 

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/error.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/error.c?rev=764729&r1=764728&r2=764729&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/error.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/error.c Tue Apr 14 10:28:30 2009
@@ -377,7 +377,7 @@
 }
 #endif
 
-#if !defined(WIN32) && !defined(HPUX11)
+#if HAVE_STRERROR_R
 /* glibc style */
 static char *native_strerror(int statcode, char *buf,
                              acr_size_t bufsize)