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;