Subject: | [PATCH] Missing symbols on systems without strlcpy() and strlcat() |
Although using strlcpy() and strlcat() functions has been a big part of
Perl 5.10, they aren't available everywhere. The Perl API now has
my_strlcpy() and my_strlcat() which will either be a macro over the libc
versions or a independent implementation in Perl itself. Recent
Devel::PPPort's have it too. So, the patch is a two part process.
First, upgrade to a recent Devel::PPPort and run...
perl -MDevel::PPPort -wle'Devel::PPPort::WriteFile();'
in the PathTools distribution directory. Then, apply the following patch
--- Cwd.xs.old 2008-01-14 07:35:49.000000000 -0600
+++ Cwd.xs 2008-01-14 09:08:10.000000000 -0600
@@ -83,14 +83,14 @@
if (path[1] == '\0')
return (resolved);
resolved_len = 1;
- left_len = strlcpy(left, path + 1, sizeof(left));
+ left_len = my_strlcpy(left, path + 1, sizeof(left));
} else {
if (getcwd(resolved, MAXPATHLEN) == NULL) {
- strlcpy(resolved, ".", MAXPATHLEN);
+ my_strlcpy(resolved, ".", MAXPATHLEN);
return (NULL);
}
resolved_len = strlen(resolved);
- left_len = strlcpy(left, path, sizeof(left));
+ left_len = my_strlcpy(left, path, sizeof(left));
}
if (left_len >= sizeof(left) || resolved_len >= MAXPATHLEN) {
errno = ENAMETOOLONG;
@@ -147,7 +147,7 @@
* lstat() fails we still can return successfully if
* there are no more path components left.
*/
- resolved_len = strlcat(resolved, next_token, MAXPATHLEN);
+ resolved_len = my_strlcat(resolved, next_token, MAXPATHLEN);
if (resolved_len >= MAXPATHLEN) {
errno = ENAMETOOLONG;
return (NULL);
@@ -198,13 +198,13 @@
symlink[slen] = '/';
symlink[slen + 1] = 0;
}
- left_len = strlcat(symlink,
left, sizeof(left));
+ left_len = my_strlcat(symlink,
left, sizeof(left));
if (left_len >= sizeof(left)) {
errno = ENAMETOOLONG;
return (NULL);
}
}
- left_len = strlcpy(left, symlink,
sizeof(left));
+ left_len = my_strlcpy(left, symlink,
sizeof(left));
}
}
#endif