summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/_strerror.c2
-rw-r--r--sysdeps/mach/hurd/errlist.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/sysdeps/generic/_strerror.c b/sysdeps/generic/_strerror.c
index 53ff9343e1..4a9b032c86 100644
--- a/sysdeps/generic/_strerror.c
+++ b/sysdeps/generic/_strerror.c
@@ -40,7 +40,7 @@
char *
__strerror_r (int errnum, char *buf, size_t buflen)
{
- if (errnum < 0 || errnum >= _sys_nerr)
+ if (errnum < 0 || errnum >= _sys_nerr || _sys_errlist[errnum] == NULL)
{
/* Buffer we use to print the number in. For a maximum size for
`int' of 8 bytes we never need more than 20 digits. */
diff --git a/sysdeps/mach/hurd/errlist.c b/sysdeps/mach/hurd/errlist.c
index 5cbc543ed1..f1ca0dc3ae 100644
--- a/sysdeps/mach/hurd/errlist.c
+++ b/sysdeps/mach/hurd/errlist.c
@@ -21,6 +21,8 @@
indices by taking their subcode. */
#define SYS_ERRLIST _hurd_errlist
#define SYS_NERR _hurd_nerr
-#define ERR_REMAP(n) (n & 0x3fff)
+
+#include <mach/error.h>
+#define ERR_REMAP(n) (err_get_code (n))
#include <sysdeps/gnu/errlist.c>