From owner-svn-src-all@FreeBSD.ORG Fri Oct 17 21:29:06 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CDC91065698; Fri, 17 Oct 2008 21:29:06 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B63F8FC13; Fri, 17 Oct 2008 21:29:06 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HLT6GO098366; Fri, 17 Oct 2008 21:29:06 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HLT5BT098365; Fri, 17 Oct 2008 21:29:05 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200810172129.m9HLT5BT098365@svn.freebsd.org> From: Xin LI Date: Fri, 17 Oct 2008 21:29:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183990 - head/lib/libc/string X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 21:29:06 -0000 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;