]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(__getcwd): Clarify a comment.
authorJim Meyering <jim@meyering.net>
Sun, 19 Mar 2006 17:18:32 +0000 (17:18 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 19 Mar 2006 17:18:32 +0000 (17:18 +0000)
Use memcpy in place of a call to strcpy.

lib/getcwd.c

index 5bb9e4be14eb61de5be91734fb4cacd065624d56..739ef44c788cfd203c81beeb1646453b9c61e62a 100644 (file)
@@ -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.