fwscanf(3) returns ZERO instead of EOF when encountering an early matching failur

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

fwscanf(3) returns ZERO instead of EOF when encountering an early matching failur

Kevin Lo
Hi,

The diff below from FreeBSD r326635 fixes the return value of fwscanf(3)
when encountering an early matching failure as the PR noted:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202240

Index: lib/libc/stdio/vfwscanf.c
===================================================================
RCS file: /cvs/src/lib/libc/stdio/vfwscanf.c,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 vfwscanf.c
--- lib/libc/stdio/vfwscanf.c 30 Oct 2016 05:07:06 -0000 1.6
+++ lib/libc/stdio/vfwscanf.c 7 Dec 2017 02:17:51 -0000
@@ -165,7 +165,7 @@ literal:
  goto input_failure;
  if (wi != c) {
  __ungetwc(wi, fp);
- goto input_failure;
+ goto match_failure;
  }
  nread++;
  continue;

Reply | Threaded
Open this post in threaded view
|

Re: fwscanf(3) returns ZERO instead of EOF when encountering an early matching failur

Todd C. Miller-2
On Thu, 07 Dec 2017 10:44:43 +0800, Kevin Lo wrote:

> The diff below from FreeBSD r326635 fixes the return value of fwscanf(3)
> when encountering an early matching failure as the PR noted:
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202240

OK millert@
That diff brings fwscanf(3) back in line with fscanf(3).

 - todd