harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r499407 - /harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hyerrorhelpers.c
Date Wed, 24 Jan 2007 13:55:48 GMT
Author: hindessm
Date: Wed Jan 24 05:55:47 2007
New Revision: 499407

URL: http://svn.apache.org/viewvc?view=rev&rev=499407
Log:
Make errorMessage use the thread-safe strerror_r rather than strerror.

Modified:
    harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hyerrorhelpers.c

Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hyerrorhelpers.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hyerrorhelpers.c?view=diff&rev=499407&r1=499406&r2=499407
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hyerrorhelpers.c
(original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/unix/hyerrorhelpers.c
Wed Jan 24 05:55:47 2007
@@ -30,11 +30,14 @@
 
 #undef CDEV_CURRENT_FUNCTION
 
-#include <string.h>
 #include <errno.h>
 #include "portpriv.h"
 #include "hyportptb.h"
 
+/* Ensure we get the recommended XSI-compliant strerror_r() */
+#define _XOPEN_SOURCE 600
+#include <string.h>
+
 #define CDEV_CURRENT_FUNCTION errorMessage
 /**
  * @internal
@@ -70,9 +73,8 @@
     }
 
   /* Copy from OS to ptBuffers */
-  portLibrary->str_printf (portLibrary, ptBuffers->errorMessageBuffer,
-                           ptBuffers->errorMessageBufferSize,
-                           strerror (errorCode));
+  strerror_r(errorCode,
+             ptBuffers->errorMessageBuffer, ptBuffers->errorMessageBufferSize);
   ptBuffers->errorMessageBuffer[ptBuffers->errorMessageBufferSize - 1] = '\0';
   return ptBuffers->errorMessageBuffer;
 }



Mime
View raw message