Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Dec 2017 21:12:24 +0000 (UTC)
From:      "Stephen J. Kiernan" <stevek@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326635 - head/lib/libc/stdio
Message-ID:  <201712062112.vB6LCOWN019069@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712062112.vB6LCOWN019069>