X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Fvfscanf.c;h=e1c8b4b40efd8fd28040cbf47600647ab0e9e4bb;hb=a23af99aed77b11c90cbcb9ca4d8aef7959e92d6;hp=8f121e95e4a73cac03d000cf6a96132e2163e5ab;hpb=02d039809be3e35702c56aafb1d84cf90e9b8395;p=pdclib.old diff --git a/functions/stdio/vfscanf.c b/functions/stdio/vfscanf.c index 8f121e9..e1c8b4b 100644 --- a/functions/stdio/vfscanf.c +++ b/functions/stdio/vfscanf.c @@ -53,10 +53,14 @@ int vfscanf( FILE * _PDCLIB_restrict stream, const char * _PDCLIB_restrict forma if ( ( ( c = getc( stream ) ) != *format ) || feof( stream ) ) /* TODO: Check EOF status directly */ { /* Matching error */ - if ( ! feof( stream ) ) /* TODO: Check EOF status directly */ + if ( ! feof( stream ) && ! ferror( stream ) ) /* TODO: Check EOF status directly */ { ungetc( c, stream ); } + else if ( status.n == 0 ) + { + return EOF; + } return status.n; } else