aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils.h
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2012-06-27 18:42:25 +0200
committerTobias Brunner <tobias@strongswan.org>2012-06-28 13:14:52 +0200
commit2a5952765956192359a0f0b8506c5ec266a6d387 (patch)
tree7dd35aa03c29cf68c1b3ce7d79b2adabc265a133 /src/libstrongswan/utils.h
parent0f018a732469b5cf4a6791886c95400fecca690a (diff)
downloadstrongswan-2a5952765956192359a0f0b8506c5ec266a6d387.tar.bz2
strongswan-2a5952765956192359a0f0b8506c5ec266a6d387.tar.xz
Thread-safe wrapper around strerror(3)/strerror_r(3) added
Diffstat (limited to 'src/libstrongswan/utils.h')
-rw-r--r--src/libstrongswan/utils.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/libstrongswan/utils.h b/src/libstrongswan/utils.h
index aeaa4e74b..954925dab 100644
--- a/src/libstrongswan/utils.h
+++ b/src/libstrongswan/utils.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2011 Tobias Brunner
+ * Copyright (C) 2008-2012 Tobias Brunner
* Copyright (C) 2008 Martin Willi
* Hochschule fuer Technik Rapperswil
*
@@ -410,6 +410,18 @@ char *translate(char *str, const char *from, const char *to);
*/
bool mkdir_p(const char *path, mode_t mode);
+/**
+ * Thread-safe wrapper around strerror and strerror_r.
+ *
+ * This is required because the first is not thread-safe (on some platforms)
+ * and the second uses two different signatures (POSIX/GNU) and is impractical
+ * to use anyway.
+ *
+ * @param errnum error code (i.e. errno)
+ * @return error message
+ */
+const char *safe_strerror(int errnum);
+
#ifndef HAVE_CLOSEFROM
/**
* Close open file descriptors greater than or equal to lowfd.
@@ -628,7 +640,6 @@ bool cas_bool(bool *ptr, bool oldval, bool newval);
*/
bool cas_ptr(void **ptr, void *oldval, void *newval);
-
#endif /* HAVE_GCC_ATOMIC_OPERATIONS */
/**