chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] restore OWNER/GROUP assignment in rule coming from RESULT
[elogind.git]
/
klibc
/
klibc
/
strerror.c
diff --git
a/klibc/klibc/strerror.c
b/klibc/klibc/strerror.c
index 754a30693cc54f4100860a2e9290e8764fae8783..c8e3eac793517244258542cc535dda19ebbd430b 100644
(file)
--- a/
klibc/klibc/strerror.c
+++ b/
klibc/klibc/strerror.c
@@
-7,19
+7,28
@@
char *strerror(int errnum)
{
static char message[32] = "error "; /* enough for error 2^63-1 */
char *strerror(int errnum)
{
static char message[32] = "error "; /* enough for error 2^63-1 */
-
char numbuf[32];
char *p;
char numbuf[32];
char *p;
- int len;
+ unsigned int e = (unsigned int)errnum;
+
+#ifdef WITH_ERRLIST
+ extern const int sys_nerr;
+ extern const char * const sys_errlist[];
+
+ if ( e < (unsigned int)sys_nerr && sys_errlist[e] )
+ return (char *)sys_errlist[e];
+#endif
p = numbuf+sizeof numbuf;
*--p = '\0';
do {
p = numbuf+sizeof numbuf;
*--p = '\0';
do {
- *--p = (errnum % 10) + '0';
- errnum /= 10;
- } while ( errnum );
+ *--p = (e % 10) + '0';
+ e /= 10;
+ } while ( e );
+
+ memcpy(message+6, p, (numbuf+sizeof numbuf)-p);
- return
(char *)memcpy(message+6, p, (numbuf+sizeof numbuf)-p)
;
+ return
message
;
}
}