From owner-svn-src-head@freebsd.org Wed Dec 6 21:12:25 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC64BE8C41D; Wed, 6 Dec 2017 21:12:25 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 996113175; Wed, 6 Dec 2017 21:12:25 +0000 (UTC) (envelope-from stevek@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vB6LCOlG019070; Wed, 6 Dec 2017 21:12:24 GMT (envelope-from stevek@FreeBSD.org) Received: (from stevek@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB6LCOWN019069; Wed, 6 Dec 2017 21:12:24 GMT (envelope-from stevek@FreeBSD.org) Message-Id: <201712062112.vB6LCOWN019069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: stevek set sender to stevek@FreeBSD.org using -f From: "Stephen J. Kiernan" Date: Wed, 6 Dec 2017 21:12:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326635 - head/lib/libc/stdio X-SVN-Group: head X-SVN-Commit-Author: stevek X-SVN-Commit-Paths: head/lib/libc/stdio X-SVN-Commit-Revision: 326635 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Dec 2017 21:12:25 -0000 Author: stevek Date: Wed Dec 6 21:12:24 2017 New Revision: 326635 URL: https://svnweb.freebsd.org/changeset/base/326635 Log: The function fwscanf() return value is wrong when encountering an early matching failure. According to the Open Group documentation for fwscanf: "Upon successful completion, these functions shall return the number of successfully matched and assigned input items; this number can be zero in the event of an early matching failure." Without this change, fwscanf would return EOF in the case of an early matching failure, instead of the proper return value of 0. This change aligns fwscanf(3) with the implementation in fscanf(3). PR: 202240 Submitted by: rajendra.sy@gmail.com Reviewed by: jhb, cem Approved by: sjg (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D13288 Modified: head/lib/libc/stdio/vfwscanf.c Modified: head/lib/libc/stdio/vfwscanf.c ============================================================================== --- head/lib/libc/stdio/vfwscanf.c Wed Dec 6 21:00:41 2017 (r326634) +++ head/lib/libc/stdio/vfwscanf.c Wed Dec 6 21:12:24 2017 (r326635) @@ -494,7 +494,7 @@ literal: goto input_failure; if (wi != c) { __ungetwc(wi, fp, locale); - goto input_failure; + goto match_failure; } nread++; continue;