From: Jim Meyering Date: Sun, 19 Mar 2006 17:18:32 +0000 (+0000) Subject: (__getcwd): Clarify a comment. X-Git-Tag: v6.0~590 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e233777dbe95d8c8e4135a098503660c6dbaa451;p=thirdparty%2Fcoreutils.git (__getcwd): Clarify a comment. Use memcpy in place of a call to strcpy. --- diff --git a/lib/getcwd.c b/lib/getcwd.c index 5bb9e4be14..739ef44c78 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.