- (bal) bsd-getcwd.c and bsd-setenv.c changed from bcopy() to memmove()

This commit is contained in:
Ben Lindstrom 2001-01-05 06:09:52 +00:00
parent 91c2a985f9
commit 8835a89105
3 changed files with 6 additions and 5 deletions

View File

@ -1,5 +1,6 @@
20010105 20010105
- (bal) contrib/caldera/ provided by Tim Rice <tim@multitalents.net> - (bal) contrib/caldera/ provided by Tim Rice <tim@multitalents.net>
- (bal) bsd-getcwd.c and bsd-setenv.c changed from bcopy() to memmove()
20010104 20010104
- (djm) Fix memory leak on systems with BROKEN_GETADDRINFO. Based on - (djm) Fix memory leak on systems with BROKEN_GETADDRINFO. Based on

View File

@ -119,7 +119,7 @@ getcwd(char *pt,size_t size)
* path to the beginning of the buffer, but it's always * path to the beginning of the buffer, but it's always
* been that way and stuff would probably break. * been that way and stuff would probably break.
*/ */
bcopy(bpt, pt, ept - bpt); memmove(bpt, pt, ept - bpt);
free(up); free(up);
return (pt); return (pt);
} }
@ -170,7 +170,7 @@ getcwd(char *pt,size_t size)
goto notfound; goto notfound;
if (ISDOT(dp)) if (ISDOT(dp))
continue; continue;
bcopy(dp->d_name, bup, dp->d_namlen + 1); memmove(dp->d_name, bup, dp->d_namlen + 1);
/* Save the first error for later. */ /* Save the first error for later. */
if (lstat(up, &s)) { if (lstat(up, &s)) {
@ -202,13 +202,13 @@ getcwd(char *pt,size_t size)
pt = npt; pt = npt;
bpt = pt + off; bpt = pt + off;
ept = pt + ptsize; ept = pt + ptsize;
bcopy(bpt, ept - len, len); memmove(bpt, ept - len, len);
bpt = ept - len; bpt = ept - len;
} }
if (!first) if (!first)
*--bpt = '/'; *--bpt = '/';
bpt -= dp->d_namlen; bpt -= dp->d_namlen;
bcopy(dp->d_name, bpt, dp->d_namlen); memmove(dp->d_name, bpt, dp->d_namlen);
(void)closedir(dir); (void)closedir(dir);
/* Truncate any file name. */ /* Truncate any file name. */

View File

@ -122,7 +122,7 @@ setenv(name, value, rewrite)
(cnt + 2))); (cnt + 2)));
if (!P) if (!P)
return (-1); return (-1);
bcopy(environ, P, cnt * sizeof(char *)); memmove(environ, P, cnt * sizeof(char *));
environ = P; environ = P;
} }
environ[cnt + 1] = NULL; environ[cnt + 1] = NULL;