]>
Commit | Line | Data |
---|---|---|
224c7076 A |
1 | --- strerror.c.orig 2004-11-25 11:38:47.000000000 -0800 |
2 | +++ strerror.c 2005-04-30 01:26:56.000000000 -0700 | |
3 | @@ -50,12 +50,13 @@ | |
4 | */ | |
5 | #define EBUFSIZE (20 + sizeof(UPREFIX)) | |
6 | ||
7 | +#ifndef BUILDING_VARIANT | |
8 | /* | |
9 | * Doing this by hand instead of linking with stdio(3) avoids bloat for | |
10 | * statically linked binaries. | |
11 | */ | |
12 | -static void | |
13 | -errstr(int num, char *buf, size_t len) | |
14 | +__private_extern__ void | |
15 | +__errstr(int num, char *buf, size_t len) | |
16 | { | |
17 | char *t; | |
18 | unsigned int uerr; | |
19 | @@ -77,14 +78,17 @@ | |
20 | strerror_r(int errnum, char *strerrbuf, size_t buflen) | |
21 | { | |
22 | ||
23 | - if (errnum < 1 || errnum >= sys_nerr) { | |
24 | - errstr(errnum, strerrbuf, buflen); | |
25 | + if (errnum < 0 || errnum >= sys_nerr) { | |
26 | + __errstr(errnum, strerrbuf, buflen); | |
27 | return (EINVAL); | |
28 | } | |
29 | if (strlcpy(strerrbuf, sys_errlist[errnum], buflen) >= buflen) | |
30 | return (ERANGE); | |
31 | return (0); | |
32 | } | |
33 | +#else /* BUILDING_VARIANT */ | |
34 | +__private_extern__ void __errstr(int, char *, size_t); | |
35 | +#endif /* !BUILDING_VARIANT */ | |
36 | ||
37 | char * | |
38 | strerror(int num) | |
39 | @@ -93,7 +97,9 @@ | |
40 | ||
41 | if (num > 0 && num < sys_nerr) | |
42 | return ((char *)sys_errlist[num]); | |
43 | +#if !__DARWIN_UNIX03 | |
44 | errno = EINVAL; | |
45 | - errstr(num, ebuf, sizeof(ebuf)); | |
46 | +#endif /* !__DARWIN_UNIX03 */ | |
47 | + __errstr(num, ebuf, sizeof(ebuf)); | |
48 | return (ebuf); | |
49 | } |