diff options
author | Michael Brown | 2006-12-20 04:54:20 +0100 |
---|---|---|
committer | Michael Brown | 2006-12-20 04:54:20 +0100 |
commit | fc7dcc201be5a1f6721ff8d467a9685c480e004a (patch) | |
tree | e036ba3975566512f1222dd94e91391e298acd14 /src/hci/strerror.c | |
parent | Split strerror() out from errno.c (diff) | |
download | ipxe-fc7dcc201be5a1f6721ff8d467a9685c480e004a.tar.gz ipxe-fc7dcc201be5a1f6721ff8d467a9685c480e004a.tar.xz ipxe-fc7dcc201be5a1f6721ff8d467a9685c480e004a.zip |
Added messages for some of the most common errors
Diffstat (limited to 'src/hci/strerror.c')
-rw-r--r-- | src/hci/strerror.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/hci/strerror.c b/src/hci/strerror.c index 10344f55..8ed5d273 100644 --- a/src/hci/strerror.c +++ b/src/hci/strerror.c @@ -38,6 +38,10 @@ const char * strerror ( int errno ) { static char *generic_message = "Error 0x0000"; struct errortab *errortab; + /* Allow for strerror(rc) as well as strerror(errno) */ + if ( errno < 0 ) + errno = -errno; + for ( errortab = errortab_start ; errortab < errortab_end ; errortab++ ) { if ( errortab->errno == errno ) @@ -47,3 +51,10 @@ const char * strerror ( int errno ) { sprintf ( generic_message + 8, "%hx", errno ); return generic_message; } + +/** The most common errors */ +struct errortab common_errortab[] __errortab = { + { ENOMEM, "Out of memory" }, + { EINVAL, "Invalid argument" }, + { ENOSPC, "No space left on device" }, +}; |