summaryrefslogtreecommitdiff
path: root/src/port/string.c
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2009-02-16 17:03:31 +0100
committerAndreas Baumann <abaumann@yahoo.com>2009-02-16 17:03:31 +0100
commita10602d7b29336460e50bd50d683321595f0aada (patch)
tree0e7d50881d57cc807e27d3d25335f4d02635c33f /src/port/string.c
parentee34e214a4f35439885fc797dd84bbf8f629c20e (diff)
downloadwolfbones-a10602d7b29336460e50bd50d683321595f0aada.tar.gz
wolfbones-a10602d7b29336460e50bd50d683321595f0aada.tar.bz2
strerror_r tests shows how we can leave libwolf.a sane and test the original and the stub function
Diffstat (limited to 'src/port/string.c')
-rw-r--r--src/port/string.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/port/string.c b/src/port/string.c
index a87a1a2..20e2bed 100644
--- a/src/port/string.c
+++ b/src/port/string.c
@@ -42,7 +42,7 @@ extern int dummy; /* prevent ISO C forbids an empty source file' warning */
/**
* strerror_r exists in various fassions (XSI and GNU flavour in glibc). We stick to
- * the API of POSIX1 of course..
+ * the API of POSIX.1 of course (XSI-compliant)..
*/
#if !defined HAVE_STRERROR_R
@@ -56,6 +56,10 @@ int wolf_strerror_r( int num, char *buf, size_t buflen ) {
int len;
msg = strerror( num );
+ /* TODO: can we detect illegal error numbers? For sure on Linux NULL
+ * is never returned and a strcmp with prefix "Unknown error" or similar
+ * is not really acceptable.
+ */
if( msg == NULL ) {
len = snprintf( buf, buflen, "Unknown error %d", num );
errno = EINVAL;