diff options
Diffstat (limited to 'usr/src/cmd/sgs/rtld/common/external.c')
-rw-r--r-- | usr/src/cmd/sgs/rtld/common/external.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/usr/src/cmd/sgs/rtld/common/external.c b/usr/src/cmd/sgs/rtld/common/external.c index e2ebd89145..4a16ffcf9b 100644 --- a/usr/src/cmd/sgs/rtld/common/external.c +++ b/usr/src/cmd/sgs/rtld/common/external.c @@ -22,6 +22,7 @@ /* * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2014 Garrett D'Amore <garrett@damore.org> + * Copyright 2015 Joyent, Inc. */ /* @@ -180,6 +181,7 @@ #include <synch.h> #include <strings.h> #include <stdio.h> +#include <libintl.h> #include <debug.h> #include <libc_int.h> #include "_elf.h" @@ -718,3 +720,24 @@ isalnum(int c) { return ((isalpha(c) || isdigit(c)) ? 1 : 0); } + +/* + * In a similar vein to the is* functions above, we also have to define our own + * version of strerror, as it is implemented in terms of the locale aware + * strerror_l, and we'd rather not have the full set of libc symbols used here. + */ +extern const char _sys_errs[]; +extern const int _sys_index[]; +extern int _sys_num_err; + +char * +strerror(int errnum) +{ + if (errnum < _sys_num_err && errnum >= 0) { + return (dgettext("SUNW_OST_OSLIB", + (char *)&_sys_errs[_sys_index[errnum]])); + } + + errno = EINVAL; + return (dgettext("SUNW_OST_OSLIB", "Unknown error")); +} |