]> git.ipfire.org Git - people/ms/strongswan.git/commitdiff
Defined a macro to replace strerror(3) with calls to thread-safe wrapper
authorTobias Brunner <tobias@strongswan.org>
Thu, 28 Jun 2012 10:13:05 +0000 (12:13 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 28 Jun 2012 11:14:52 +0000 (13:14 +0200)
src/libstrongswan/utils.c
src/libstrongswan/utils.h

index f613b0c647749c8a4a133c7c0214cd58c94d0c0f..8c0c7f46c5cf6107276e970636b3dba4435a4ab2 100644 (file)
@@ -254,6 +254,8 @@ const char *safe_strerror(int errnum)
        return msg;
 }
 #else /* HAVE_STRERROR_R */
+/* we actually wan't to call strerror(3) below */
+#undef strerror
 /*
  * Described in header.
  */
index 954925dab7c5205285ece361aa446a6409444613..c671a2e08a2f9a34a067f7c327988cee9b5e8bd5 100644 (file)
@@ -422,6 +422,11 @@ bool mkdir_p(const char *path, mode_t mode);
  */
 const char *safe_strerror(int errnum);
 
+/**
+ * Replace usages of strerror(3) with thread-safe variant.
+ */
+#define strerror(errnum) safe_strerror(errnum)
+
 #ifndef HAVE_CLOSEFROM
 /**
  * Close open file descriptors greater than or equal to lowfd.