summaryrefslogtreecommitdiffstats
path: root/common/misc.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2008-11-10 17:40:09 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2008-11-10 17:40:09 +0100
commit54ec87f0cb60c456e276001022131f358fcd1370 (patch)
treeac3c4cf318efe1a5eae23e4859742c9836617787 /common/misc.c
parent87d4b9ec0943ffa9087f8762a70b42387ad79fd4 (diff)
downloadbarebox-54ec87f0cb60c456e276001022131f358fcd1370.tar.gz
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/misc.c')
-rw-r--r--common/misc.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/common/misc.c b/common/misc.c
index 920ac49..cf65849 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);