X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/c957a83bde4df2e2d3d1ed0963656856b48ef0a0..224c70764cab4e0e39a26aaf3ad3016552f62f55:/string/FreeBSD/strerror.c.patch diff --git a/string/FreeBSD/strerror.c.patch b/string/FreeBSD/strerror.c.patch new file mode 100644 index 0000000..077e741 --- /dev/null +++ b/string/FreeBSD/strerror.c.patch @@ -0,0 +1,49 @@ +--- strerror.c.orig 2004-11-25 11:38:47.000000000 -0800 ++++ strerror.c 2005-04-30 01:26:56.000000000 -0700 +@@ -50,12 +50,13 @@ + */ + #define EBUFSIZE (20 + sizeof(UPREFIX)) + ++#ifndef BUILDING_VARIANT + /* + * Doing this by hand instead of linking with stdio(3) avoids bloat for + * statically linked binaries. + */ +-static void +-errstr(int num, char *buf, size_t len) ++__private_extern__ void ++__errstr(int num, char *buf, size_t len) + { + char *t; + unsigned int uerr; +@@ -77,14 +78,17 @@ + strerror_r(int errnum, char *strerrbuf, size_t buflen) + { + +- if (errnum < 1 || errnum >= sys_nerr) { +- errstr(errnum, strerrbuf, buflen); ++ if (errnum < 0 || errnum >= sys_nerr) { ++ __errstr(errnum, strerrbuf, buflen); + return (EINVAL); + } + if (strlcpy(strerrbuf, sys_errlist[errnum], buflen) >= buflen) + return (ERANGE); + return (0); + } ++#else /* BUILDING_VARIANT */ ++__private_extern__ void __errstr(int, char *, size_t); ++#endif /* !BUILDING_VARIANT */ + + char * + strerror(int num) +@@ -93,7 +97,9 @@ + + if (num > 0 && num < sys_nerr) + return ((char *)sys_errlist[num]); ++#if !__DARWIN_UNIX03 + errno = EINVAL; +- errstr(num, ebuf, sizeof(ebuf)); ++#endif /* !__DARWIN_UNIX03 */ ++ __errstr(num, ebuf, sizeof(ebuf)); + return (ebuf); + }