From owner-svn-src-all@FreeBSD.ORG Sun Apr 22 21:28:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2C3941065672; Sun, 22 Apr 2012 21:28:15 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 183588FC12; Sun, 22 Apr 2012 21:28:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q3MLSE5x059847; Sun, 22 Apr 2012 21:28:14 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q3MLSENU059845; Sun, 22 Apr 2012 21:28:14 GMT (envelope-from das@svn.freebsd.org) Message-Id: <201204222128.q3MLSENU059845@svn.freebsd.org> From: David Schultz Date: Sun, 22 Apr 2012 21:28:14 +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: r234587 - head/lib/libc/stdio 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: Sun, 22 Apr 2012 21:28:15 -0000 Author: das Date: Sun Apr 22 21:28:14 2012 New Revision: 234587 URL: http://svn.freebsd.org/changeset/base/234587 Log: Bugfix: Correctly count the number of characters read for %l[ conversions. Modified: head/lib/libc/stdio/vfscanf.c Modified: head/lib/libc/stdio/vfscanf.c ============================================================================== --- head/lib/libc/stdio/vfscanf.c Sun Apr 22 21:22:14 2012 (r234586) +++ head/lib/libc/stdio/vfscanf.c Sun Apr 22 21:28:14 2012 (r234587) @@ -248,12 +248,12 @@ convert_wccl(FILE *fp, wchar_t *wcp, int { mbstate_t mbs; wchar_t twc; - int n, nchars, nconv, nread; + int n, nchars, nconv; char buf[MB_CUR_MAX]; if (wcp == SUPPRESS_PTR) wcp = &twc; - n = nread = 0; + n = 0; nchars = 0; while (width != 0) { if (n == MB_CUR_MAX) { @@ -279,7 +279,6 @@ convert_wccl(FILE *fp, wchar_t *wcp, int } break; } - nread += n; width--; if (wcp != &twc) wcp++; @@ -298,12 +297,10 @@ convert_wccl(FILE *fp, wchar_t *wcp, int fp->_flags |= __SERR; return (-1); } - n = nchars; - if (n == 0) + if (nchars == 0) return (0); *wcp = L'\0'; - /* XXX This matches historical behavior, but it's wrong. */ - return (nread + n); + return (nchars); } static __inline int