svn commit: r183990 - head/lib/libc/string

Xin LI delphij at FreeBSD.org
Fri Oct 17 21:29:06 UTC 2008


Author: delphij
Date: Fri Oct 17 21:29:05 2008
New Revision: 183990
URL: http://svn.freebsd.org/changeset/base/183990

Log:
  Use strlcpy() in !localized case to avoid the -1's.

Modified:
  head/lib/libc/string/strxfrm.c

Modified: head/lib/libc/string/strxfrm.c
==============================================================================
--- head/lib/libc/string/strxfrm.c	Fri Oct 17 21:21:14 2008	(r183989)
+++ head/lib/libc/string/strxfrm.c	Fri Oct 17 21:29:05 2008	(r183990)
@@ -51,8 +51,7 @@ strxfrm(char * __restrict dest, const ch
 			if (slen < len)
 				strcpy(dest, src);
 			else {
-				strncpy(dest, src, len - 1);
-				dest[len - 1] = '\0';
+				strlcpy(dest, src, len);
 			}
 		}
 		return slen;


More information about the svn-src-head mailing list