diff options
author | bde <bde@FreeBSD.org> | 2001-11-11 02:48:09 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2001-11-11 02:48:09 +0000 |
commit | eb58f0f1a85857ed4be993a454e8aafed1b43b58 (patch) | |
tree | 9f56244d965dec1345589fb1aa8b7b147549c0dd /lib | |
parent | fdac350c9d2806675dca447df23111492108d0b9 (diff) | |
download | FreeBSD-src-eb58f0f1a85857ed4be993a454e8aafed1b43b58.zip FreeBSD-src-eb58f0f1a85857ed4be993a454e8aafed1b43b58.tar.gz |
Fixed namespace pollution related to `err' in libc in the same way as for
`warn'. Now a whole 2 members of the err() family don't cause pollution.
This fixes world breakage in awk for NOSHARED worlds. contrib/awk/msg.c
has had its own version of err() for a long time, but this somehow
didn't cause problems until the update to awk-3.1.0.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/err.c | 4 | ||||
-rw-r--r-- | lib/libc/gen/stringlist.c | 11 | ||||
-rw-r--r-- | lib/libc/include/namespace.h | 1 | ||||
-rw-r--r-- | lib/libc/include/un-namespace.h | 1 | ||||
-rw-r--r-- | lib/libc/net/nsdispatch.c | 4 | ||||
-rw-r--r-- | lib/libc/net/nslexer.l | 3 |
6 files changed, 17 insertions, 7 deletions
diff --git a/lib/libc/gen/err.c b/lib/libc/gen/err.c index 528fa86..fd4135b 100644 --- a/lib/libc/gen/err.c +++ b/lib/libc/gen/err.c @@ -72,8 +72,10 @@ err_set_exit(void (*ef)(int)) err_exit = ef; } +__weak_reference(_err, err); + void -err(int eval, const char *fmt, ...) +_err(int eval, const char *fmt, ...) { va_list ap; va_start(ap, fmt); diff --git a/lib/libc/gen/stringlist.c b/lib/libc/gen/stringlist.c index bb74919..abe4e00 100644 --- a/lib/libc/gen/stringlist.c +++ b/lib/libc/gen/stringlist.c @@ -31,9 +31,14 @@ * SUCH DAMAGE. */ +#if 0 #if defined(LIBC_SCCS) && !defined(lint) static char *rcsid = "$NetBSD: stringlist.c,v 1.2 1997/01/17 07:26:20 lukem Exp $"; #endif /* LIBC_SCCS and not lint */ +#endif + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); #include <stdio.h> #include <string.h> @@ -51,13 +56,13 @@ sl_init() { StringList *sl = malloc(sizeof(StringList)); if (sl == NULL) - err(1, "stringlist: %m"); + _err(1, "stringlist: %m"); sl->sl_cur = 0; sl->sl_max = _SL_CHUNKSIZE; sl->sl_str = malloc(sl->sl_max * sizeof(char *)); if (sl->sl_str == NULL) - err(1, "stringlist: %m"); + _err(1, "stringlist: %m"); return sl; } @@ -74,7 +79,7 @@ sl_add(sl, name) sl->sl_max += _SL_CHUNKSIZE; sl->sl_str = reallocf(sl->sl_str, sl->sl_max * sizeof(char *)); if (sl->sl_str == NULL) - err(1, "stringlist: %m"); + _err(1, "stringlist: %m"); } sl->sl_str[sl->sl_cur++] = name; } diff --git a/lib/libc/include/namespace.h b/lib/libc/include/namespace.h index 9d01520..68babbe 100644 --- a/lib/libc/include/namespace.h +++ b/lib/libc/include/namespace.h @@ -38,6 +38,7 @@ * ISO C (C90) section. Most names in libc aren't in ISO C, so they * should be here. Most aren't here... */ +#define err _err #define warn _warn /* diff --git a/lib/libc/include/un-namespace.h b/lib/libc/include/un-namespace.h index 21f099c..855c101 100644 --- a/lib/libc/include/un-namespace.h +++ b/lib/libc/include/un-namespace.h @@ -136,6 +136,7 @@ int _kevent(int, const struct kevent *, int, struct kevent *, int _flock(int, int); #endif +#undef err #undef warn #endif /* _UN_NAMESPACE_H_ */ diff --git a/lib/libc/net/nsdispatch.c b/lib/libc/net/nsdispatch.c index 311b89d..166db77 100644 --- a/lib/libc/net/nsdispatch.c +++ b/lib/libc/net/nsdispatch.c @@ -95,7 +95,7 @@ _nsdbtaddsrc(dbt, src) dbt->srclist = (ns_src *)realloc(dbt->srclist, (dbt->srclistsize + NSELEMSPERCHUNK) * sizeof(ns_src)); if (dbt->srclist == NULL) - err(1, "nsdispatch: memory allocation failure"); + _err(1, "nsdispatch: memory allocation failure"); } memmove(&dbt->srclist[dbt->srclistsize++], src, sizeof(ns_src)); } @@ -208,7 +208,7 @@ _nsdbtput(dbt) _nsmap = (ns_dbt *)realloc(_nsmap, (_nsmapsize + NSELEMSPERCHUNK) * sizeof(ns_dbt)); if (_nsmap == NULL) - err(1, "nsdispatch: memory allocation failure"); + _err(1, "nsdispatch: memory allocation failure"); } memmove(&_nsmap[_nsmapsize++], dbt, sizeof(ns_dbt)); } diff --git a/lib/libc/net/nslexer.l b/lib/libc/net/nslexer.l index 1166eed..5fa159e 100644 --- a/lib/libc/net/nslexer.l +++ b/lib/libc/net/nslexer.l @@ -84,7 +84,8 @@ STRING [a-zA-Z][a-zA-Z0-9_]* int i; if ((p = strdup(yytext)) == NULL) - err(1, "nsdispatch: memory allocation failure"); + _err(1, + "nsdispatch: memory allocation failure"); for (i = 0; i < strlen(p); i++) { if (isupper((unsigned char)p[i])) |