diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2009-03-25 10:42:48 +0100 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2009-03-25 10:42:48 +0100 |
commit | 179309442b1b6902de34941e68aa76257ae279af (patch) | |
tree | be28ce5672c9edb98ba9453585931b203a0eb876 /src/port | |
parent | c9910f786760a6055048e21583ed6488d4b354c9 (diff) | |
download | wolfbones-179309442b1b6902de34941e68aa76257ae279af.tar.gz wolfbones-179309442b1b6902de34941e68aa76257ae279af.tar.bz2 |
fixed strerror_r: it's more sensible to restore the old errno value!
Diffstat (limited to 'src/port')
-rw-r--r-- | src/port/string.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/port/string.c b/src/port/string.c index cd6a93f..e05dfbd 100644 --- a/src/port/string.c +++ b/src/port/string.c @@ -48,6 +48,7 @@ char *wolf_port_strdup( const char *s ) { #include <errno.h> /* for errno */ int wolf_port_strerror_r( int num, char *buf, size_t buflen ) { + int safe_errno = errno; const char *msg; msg = strerror( num ); @@ -64,7 +65,7 @@ int wolf_port_strerror_r( int num, char *buf, size_t buflen ) { } strncpy( buf, msg, buflen-1 ); - errno = 0; + errno = safe_errno; return 0; } |