summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-04-06 11:54:08 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2009-05-25 16:52:35 +0200
commit0f64e5c39d3a7803df49724f36170770f4ae1d48 (patch)
tree2f4bb72f67b3531a1c585392e2f4ded640c1e6cf /common
parent31c25dd6a3408e0f117eefc14477f693f8a73eb0 (diff)
downloadbarebox-0f64e5c39d3a7803df49724f36170770f4ae1d48.tar.gz
add strerror function
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/misc.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/common/misc.c b/common/misc.c
index 43c1a0c..6754696 100644
--- a/common/misc.c
+++ b/common/misc.c
@@ -75,13 +75,13 @@ int errno;
EXPORT_SYMBOL(errno);
-const char *errno_str(void)
+const char *strerror(int errnum)
{
static char errno_string[10];
#ifdef CONFIG_ERRNO_MESSAGES
char *str;
- switch(-errno) {
+ switch(errnum) {
case 0 : str = "No error"; break;
case EPERM : str = "Operation not permitted"; break;
case ENOENT : str = "No such file or directory"; break;
@@ -145,16 +145,23 @@ const char *errno_str(void)
case EREMOTEIO : str = "Remote I/O error"; break;
#endif
default:
- sprintf(errno_string, "error %d", errno);
+ sprintf(errno_string, "error %d", errnum);
return errno_string;
};
return str;
#else
- sprintf(errno_string, "error %d", errno);
+ sprintf(errno_string, "error %d", errnum);
+
return errno_string;
#endif
}
+EXPORT_SYMBOL(strerror);
+
+const char *errno_str(void)
+{
+ return strerror(-errno);
+}
EXPORT_SYMBOL(errno_str);
void perror(const char *s)