Fix $sscanf/$fscanf returning -1 after a partial match (#8457) (#8459)

This commit is contained in:
David Harris
2026-09-23 05:35:17 -04:00
committed by GitHub
parent 39e2d8e853
commit fe4b3bdec4
2 changed files with 16 additions and 2 deletions
+2 -2
View File
@@ -1832,8 +1832,8 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
return got;
done:
// Scan stopped early, return parsed or EOF
if (_vl_vsss_eof(fp, floc)) return -1;
// Scan stopped early; EOF only if input ended before the first conversion
if (got == 0 && _vl_vsss_eof(fp, floc)) return -1;
return got;
}