diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-03-27 11:55:22 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-03-27 11:55:22 +1100 |
commit | 533024be44861c8d2c8ba3232738c7d2dbbe2e4f (patch) | |
tree | 048c8bd52b50604e950d7976115ebaf42a0802ed /source4/heimdal/lib/roken/strerror_r.c | |
parent | 679854384252e698b8f8c09d31eb15ed043c919b (diff) | |
download | samba-533024be44861c8d2c8ba3232738c7d2dbbe2e4f.tar.gz samba-533024be44861c8d2c8ba3232738c7d2dbbe2e4f.tar.bz2 samba-533024be44861c8d2c8ba3232738c7d2dbbe2e4f.zip |
s4:heimdal: import lorikeet-heimdal-201003262338 (commit f4e0dc17709829235f057e0e100d34802d3929ff)
Diffstat (limited to 'source4/heimdal/lib/roken/strerror_r.c')
-rw-r--r-- | source4/heimdal/lib/roken/strerror_r.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/source4/heimdal/lib/roken/strerror_r.c b/source4/heimdal/lib/roken/strerror_r.c index 63dae09a7d..5155c28cb5 100644 --- a/source4/heimdal/lib/roken/strerror_r.c +++ b/source4/heimdal/lib/roken/strerror_r.c @@ -33,11 +33,12 @@ #include <config.h> -#if !defined(HAVE_STRERROR_R) && !defined(STRERROR_R_PROTO_COMPATIBLE) +#if (!defined(HAVE_STRERROR_R) && !defined(strerror_r)) || (!defined(STRERROR_R_PROTO_COMPATIBLE) && defined(HAVE_STRERROR_R)) #include <stdio.h> #include <string.h> #include <errno.h> +#include "roken.h" #ifdef _MSC_VER @@ -58,11 +59,6 @@ rk_strerror_r(int eno, char * strerrbuf, size_t buflen) #else /* _MSC_VER */ -#ifndef HAVE_STRERROR_R -extern int sys_nerr; -extern char *sys_errlist[]; -#endif - int ROKEN_LIB_FUNCTION rk_strerror_r(int eno, char *strerrbuf, size_t buflen) { @@ -76,11 +72,7 @@ rk_strerror_r(int eno, char *strerrbuf, size_t buflen) return 0; #else int ret; - if(eno < 0 || eno >= sys_nerr) { - snprintf(strerrbuf, buflen, "Error %d occurred.", eno); - return EINVAL; - } - ret = snprintf(strerrbuf, buflen, "%s", sys_errlist[eno]); + ret = strlcpy(strerrbuf, buflen, strerror(eno)); if (ret > buflen) return ERANGE; return 0; |