New Tot Build problem with Tot GCC (strncpy warnings)
Steve Ellcey
sellcey@cavium.com
Tue Dec 12 18:29:00 GMT 2017
On Tue, 2017-12-12 at 18:24 +0000, Joseph Myers wrote:
>Â
> > Building glibc on aarch64:
> >
> > In file included from nss_files/files-init.c:22:
> > nss_files/files-init.c: In function â_nss_files_initâ:
> > ../nscd/nscd.h:111:8: error: âstrncpyâ output truncated copying 4
> > bytes
> > from a string of length 11 [-Werror=stringop-truncation]
> > Â Â Â Â Â Â Â Â strncpy (file->dname, file->fname, len);
> > Â Â Â Â Â Â Â Â ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> These look like they should be memcpy.  The truncation is intended (it'sÂ
> copying a directory name without the trailing '/' and filename in theÂ
> source string), but since the exact amount to copy is known at that point,Â
> memcpy suffices to express the intent and should avoid the warning.
That sounds right. Â I will change strncpy to memcpy in my tree and see
if the build works.
Steve Ellcey
More information about the Libc-alpha
mailing list