From 9372c9582451c4d40152769a0aeba35e58942b59 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 9 Nov 2002 00:36:21 +0000 Subject: * string/test-strspn.c (do_test): Ensure zero termination. * string/test-strpbrk.c (do_test): Likewise. * string/test-strncmp.c (stupid_strncmp): Use strnlen, not strlen. * string/test-strncpy.c (stupid_strncpy): Likewise. * string/test-stpncpy.c (stupid_stpncpy): Likewise. 2002-10-08 Roland McGrath * string/test-string.h (test_init): Fill BUF1 and BUF2 with nonzero characters. 2002-09-22 H.J. Lu * sysdeps/unix/sysv/linux/mmap64.c (MMAP2_PAGE_SHIFT): Renamed from PAGE_SHIFT. Define if not defined. Check MMAP2_PAGE_SHIFT only if __NR_mmap2 is defined. * sysdeps/unix/sysv/linux/powerpc/mmap64.c: Moved to ... * sysdeps/unix/sysv/linux/mmap64.c: ... here. * sysdeps/unix/sysv/linux/hppa/mmap64.c: File removed. * sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c: FIle removed, --- string/test-strncpy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'string/test-strncpy.c') diff --git a/string/test-strncpy.c b/string/test-strncpy.c index 11ff30e..7820b61 100644 --- a/string/test-strncpy.c +++ b/string/test-strncpy.c @@ -47,8 +47,8 @@ simple_strncpy (char *dst, const char *src, size_t n) char * stupid_strncpy (char *dst, const char *src, size_t n) { - size_t ns = strlen (src); - size_t i, nc = n < ns ? n : ns; + size_t nc = strnlen (src, n); + size_t i; for (i = 0; i < nc; ++i) dst[i] = src[i]; -- cgit v1.1