[libc] fix scanf error handling
authorMichael Jones <michaelrj@google.com>
Fri, 18 Nov 2022 22:19:30 +0000 (14:19 -0800)
committerMichael Jones <michaelrj@google.com>
Tue, 13 Dec 2022 20:51:26 +0000 (12:51 -0800)
commitddae13c30357087797991ebd59e200abe34bd800
treebcfc8cd31821e0fd0c9a1de7003264f627a5661e
parentc8647738cd654d9ecfdc047e480d05a997d3127b
[libc] fix scanf error handling

Scanf is supposed to return EOF when it fails to make any conversions
and there is an input failure. Previously it would return EOF on a
matching failure, which may be an input failure but can also be a
parsing error.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D139891
libc/src/stdio/scanf_core/file_reader.h
libc/src/stdio/scanf_core/reader.cpp
libc/src/stdio/scanf_core/reader.h
libc/src/stdio/scanf_core/scanf_main.cpp