summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc/gen/getcwd.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/libc/gen/getcwd.c b/lib/libc/gen/getcwd.c
index bbc753b6ec0..bd7cd128364 100644
--- a/lib/libc/gen/getcwd.c
+++ b/lib/libc/gen/getcwd.c
@@ -28,7 +28,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: getcwd.c,v 1.10 2005/01/05 19:48:08 otto Exp $";
+static char rcsid[] = "$OpenBSD: getcwd.c,v 1.11 2005/01/06 03:26:02 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -118,7 +118,7 @@ getcwd(char *pt, size_t size)
* path to the beginning of the buffer, but it's always
* been that way and stuff would probably break.
*/
- bcopy(bpt, pt, ept - bpt);
+ memmove(pt, bpt, ept - bpt);
free(up);
return (pt);
}
@@ -167,7 +167,7 @@ getcwd(char *pt, size_t size)
goto notfound;
if (ISDOT(dp))
continue;
- bcopy(dp->d_name, bup, dp->d_namlen + 1);
+ memcpy(bup, dp->d_name, dp->d_namlen + 1);
/* Save the first error for later. */
if (lstat(up, &s)) {
@@ -185,27 +185,26 @@ getcwd(char *pt, size_t size)
* leading slash.
*/
if (bpt - pt < dp->d_namlen + (first ? 1 : 2)) {
- size_t len, off;
+ size_t len;
char *npt;
if (!ptsize) {
errno = ERANGE;
goto err;
}
- off = bpt - pt;
len = ept - bpt;
if ((npt = realloc(pt, ptsize *= 2)) == NULL)
goto err;
+ bpt = npt + (bpt - pt);
pt = npt;
- bpt = pt + off;
ept = pt + ptsize;
- bcopy(bpt, ept - len, len);
+ memmove(ept - len, bpt, len);
bpt = ept - len;
}
if (!first)
*--bpt = '/';
bpt -= dp->d_namlen;
- bcopy(dp->d_name, bpt, dp->d_namlen);
+ memcpy(bpt, dp->d_name, dp->d_namlen);
(void)closedir(dir);
/* Truncate any file name. */