diff options
author | nectar <nectar@FreeBSD.org> | 2003-04-29 21:13:50 +0000 |
---|---|---|
committer | nectar <nectar@FreeBSD.org> | 2003-04-29 21:13:50 +0000 |
commit | e69967f5348cec651f8806d25d2c59ac8ed8c2a2 (patch) | |
tree | e9749f1ff2693755bce73e10528fc8cc6a6563ea /lib/libc/gen/check_utility_compat.c | |
parent | 975e4bcef1ba69d85a5c90f1849accc3cd74cb65 (diff) | |
download | FreeBSD-src-e69967f5348cec651f8806d25d2c59ac8ed8c2a2.zip FreeBSD-src-e69967f5348cec651f8806d25d2c59ac8ed8c2a2.tar.gz |
`Hide' strlcpy and strlcat (using the namespace.h / __weak_reference
technique) so that we don't wind up calling into an application's
version if the application defines them.
Inspired by: qpopper's interfering and buggy version of strlcpy
Diffstat (limited to 'lib/libc/gen/check_utility_compat.c')
-rw-r--r-- | lib/libc/gen/check_utility_compat.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/libc/gen/check_utility_compat.c b/lib/libc/gen/check_utility_compat.c index 0ccdec1..2a0db43 100644 --- a/lib/libc/gen/check_utility_compat.c +++ b/lib/libc/gen/check_utility_compat.c @@ -30,15 +30,12 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -/* - * I din't use "namespace.h" here because none of the relevant utilities - * are threaded, so I'm not concerned about cancellation points or other - * niceties. - */ +#include "namespace.h" #include <limits.h> #include <stdlib.h> #include <string.h> #include <unistd.h> +#include "un-namespace.h" #ifndef LINE_MAX #define LINE_MAX _POSIX2_LINE_MAX @@ -55,7 +52,7 @@ check_utility_compat(const char *utility) int len; if ((p = getenv(_ENV_UTIL_COMPAT)) != NULL) { - strlcpy(buf, p, sizeof buf); + _strlcpy(buf, p, sizeof buf); } else { if ((len = readlink(_PATH_UTIL_COMPAT, buf, sizeof buf)) < 0) return 0; |