diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2008-11-10 17:40:09 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2008-11-10 17:40:09 +0100 |
commit | 54ec87f0cb60c456e276001022131f358fcd1370 (patch) | |
tree | ac3c4cf318efe1a5eae23e4859742c9836617787 /common | |
parent | 87d4b9ec0943ffa9087f8762a70b42387ad79fd4 (diff) | |
download | barebox-54ec87f0cb60c456e276001022131f358fcd1370.tar.gz barebox-54ec87f0cb60c456e276001022131f358fcd1370.tar.xz |
Print error number
When we do not have the appropriate error string compiled in, print
at least the number
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/misc.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/common/misc.c b/common/misc.c index 920ac49978..cf6584975f 100644 --- a/common/misc.c +++ b/common/misc.c @@ -74,12 +74,11 @@ void *sbrk (ptrdiff_t increment) int errno; EXPORT_SYMBOL(errno); -#ifndef CONFIG_ERRNO_MESSAGES -static char errno_string[5]; -#endif const char *errno_str(void) { + static char errno_string[10]; + #ifdef CONFIG_ERRNO_MESSAGES char *str; switch(-errno) { @@ -145,13 +144,13 @@ const char *errno_str(void) case EISNAM : str = "Is a named type file"; break; case EREMOTEIO : str = "Remote I/O error"; break; #endif - default : str = "unknown error"; break; + default: + sprintf(errno_string, "error %d", errno); + return errno_string; }; return str; #else - sprintf(errno_string, "%d", errno); - return errno_string; #endif } EXPORT_SYMBOL(errno_str); |