summaryrefslogtreecommitdiff
path: root/lib/getcwd.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-03-19 17:18:32 +0000
committerJim Meyering <jim@meyering.net>2006-03-19 17:18:32 +0000
commite233777dbe95d8c8e4135a098503660c6dbaa451 (patch)
treeb3d1e439a6589506761b2a10e8e337b291c2fef2 /lib/getcwd.c
parent57a06e99666fac49b92fe46b04d77ad079ec8ea0 (diff)
downloadcoreutils-e233777dbe95d8c8e4135a098503660c6dbaa451.tar.xz
(__getcwd): Clarify a comment.
Use memcpy in place of a call to strcpy.
Diffstat (limited to 'lib/getcwd.c')
-rw-r--r--lib/getcwd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/getcwd.c b/lib/getcwd.c
index 5bb9e4be1..739ef44c7 100644
--- a/lib/getcwd.c
+++ b/lib/getcwd.c
@@ -260,8 +260,8 @@ __getcwd (char *buf, size_t size)
if (d == NULL)
{
if (errno == 0)
- /* EOF on dirstream, which means that the current directory
- has been removed. */
+ /* EOF on dirstream, which can mean e.g., that the current
+ directory has been removed. */
__set_errno (ENOENT);
goto lose;
}
@@ -309,7 +309,7 @@ __getcwd (char *buf, size_t size)
while (i < dotlen);
}
- strcpy (dotlist + dotlen, d->d_name);
+ memcpy (dotlist + dotlen, d->d_name, _D_ALLOC_NAMLEN (d));
entry_status = __lstat (dotlist, &st);
#endif
/* We don't fail here if we cannot stat() a directory entry.