Functions fseeko() and fread() could fail too. So check for errors and
print debug log on failure.
---
mingw-w64-crt/testcases/t_fseeko64.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/mingw-w64-crt/testcases/t_fseeko64.c
b/mingw-w64-crt/testcases/t_fseeko64.c
index 4d57f22343d6..33aed99f9377 100644
--- a/mingw-w64-crt/testcases/t_fseeko64.c
+++ b/mingw-w64-crt/testcases/t_fseeko64.c
@@ -37,12 +37,27 @@ static int testread(wchar_t *path){
fd = _wfopen(path, L"r+bc");
if (!fd) {
+ printf("fopen failed\n");
free(readbuff);
return 1;
}
- fseeko(fd,0x100000000LL,SEEK_SET);
- fread(readbuff,sizeof(char),strlen(writebuf),fd);
+ ret = fseeko(fd,0x100000000LL,SEEK_SET);
+ if (ret != 0) {
+ printf("fseeko failed\n");
+ free(readbuff);
+ fclose(fd);
+ return ret;
+ }
+ if (fread(readbuff,sizeof(char),strlen(writebuf),fd) != strlen(writebuf)) {
+ printf("fread failed\n");
+ free(readbuff);
+ fclose(fd);
+ return 1;
+ }
ret = strncmp(readbuff,writebuf,strlen(writebuf));
+ if (ret != 0) {
+ printf("strcmp failed\n");
+ }
free(readbuff);
fclose(fd);
return ret;
--
2.20.1
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public