diff options
author | midipix <writeonce@midipix.org> | 2015-09-10 07:03:17 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2015-09-10 07:03:17 -0400 |
commit | 8af5a7aa615f2c89e0e533ab62b1932bbd726176 (patch) | |
tree | 13d3153967a9f79366e81ab794c016b5acda8bc4 /libiberty | |
parent | e0934282902c565a98ddf255c7d224d568e7161e (diff) | |
download | cbb-gcc-4.6.4-8af5a7aa615f2c89e0e533ab62b1932bbd726176.tar.bz2 cbb-gcc-4.6.4-8af5a7aa615f2c89e0e533ab62b1932bbd726176.tar.xz |
libiberty: fix the neutral implementation of xstrerror().
signed-off by Z. Gilboa; see copying.midipix (9cd0746c) for additional information.
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/neutral.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libiberty/neutral.c b/libiberty/neutral.c index a92ff1a0a..cbf1a1da6 100644 --- a/libiberty/neutral.c +++ b/libiberty/neutral.c @@ -4,6 +4,7 @@ #include <errno.h> #include <unistd.h> #include <stdio.h> +#include <string.h> #include <config.h> @@ -13,7 +14,6 @@ void * xcalloc(size_t nmemb, size_t size) {return calloc(nmemb,size);} void * xrealloc(void *ptr, size_t size) {return realloc(ptr,size);} char * xstrdup(const char *s) {return strdup(s);} char * xstrndup(const char *s, size_t n) {return strndup(s,n);} -char * xstrerror(int errnum) {return strerror(errnum);} void * xmalloc(size_t block_size) {return malloc(block_size);} void * xmemdup (const void * src, size_t copy_size, size_t alloc_size) @@ -32,3 +32,16 @@ void xmalloc_failed (size_t size) fputs("malloc failed, aborting.\n\0",stderr); _exit(1); } + +static char errdesc_fallback[64]; + +char * xstrerror(int errnum) +{ + char * errdesc; + + if ((errdesc = strerror(errnum))) + return errdesc; + + sprintf(errdesc_fallback,"Undocumented error %d.",errnum); + return errdesc_fallback; +} |