From fc7dcc201be5a1f6721ff8d467a9685c480e004a Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 20 Dec 2006 03:54:20 +0000 Subject: [PATCH] Added messages for some of the most common errors --- src/hci/strerror.c | 11 +++++++++++ 1 file changed, 11 insertions(+) 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" }, +};