summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>2003-04-29 21:13:50 +0000
committernectar <nectar@FreeBSD.org>2003-04-29 21:13:50 +0000
commite69967f5348cec651f8806d25d2c59ac8ed8c2a2 (patch)
treee9749f1ff2693755bce73e10528fc8cc6a6563ea /lib/libc/stdlib
parent975e4bcef1ba69d85a5c90f1849accc3cd74cb65 (diff)
downloadFreeBSD-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/stdlib')
-rw-r--r--lib/libc/stdlib/realpath.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libc/stdlib/realpath.c b/lib/libc/stdlib/realpath.c
index c269471..93a9856 100644
--- a/lib/libc/stdlib/realpath.c
+++ b/lib/libc/stdlib/realpath.c
@@ -67,14 +67,14 @@ realpath(const char *path, char resolved[PATH_MAX])
if (path[1] == '\0')
return (resolved);
resolved_len = 1;
- left_len = strlcpy(left, path + 1, sizeof(left));
+ left_len = _strlcpy(left, path + 1, sizeof(left));
} else {
if (getcwd(resolved, PATH_MAX) == NULL) {
- strlcpy(resolved, ".", PATH_MAX);
+ _strlcpy(resolved, ".", PATH_MAX);
return (NULL);
}
resolved_len = strlen(resolved);
- left_len = strlcpy(left, path, sizeof(left));
+ left_len = _strlcpy(left, path, sizeof(left));
}
if (left_len >= sizeof(left) || resolved_len >= PATH_MAX) {
errno = ENAMETOOLONG;
@@ -131,7 +131,7 @@ realpath(const char *path, char resolved[PATH_MAX])
* lstat() fails we still can return successfully if
* there are no more path components left.
*/
- resolved_len = strlcat(resolved, next_token, PATH_MAX);
+ resolved_len = _strlcat(resolved, next_token, PATH_MAX);
if (resolved_len >= PATH_MAX) {
errno = ENAMETOOLONG;
return (NULL);
@@ -177,13 +177,13 @@ realpath(const char *path, char resolved[PATH_MAX])
symlink[slen] = '/';
symlink[slen + 1] = 0;
}
- left_len = strlcat(symlink, left, sizeof(left));
+ left_len = _strlcat(symlink, left, sizeof(left));
if (left_len >= sizeof(left)) {
errno = ENAMETOOLONG;
return (NULL);
}
}
- left_len = strlcpy(left, symlink, sizeof(left));
+ left_len = _strlcpy(left, symlink, sizeof(left));
}
}
OpenPOWER on IntegriCloud