PATCH: pread() return non-zero if read beyond end of file

2017-11-06 Thread Xiaofeng Liu via cygwin-patches
pread() return 0 if read beyond end of file in linux, but not zero in cygwin.  I have a small code to show the problem: #include #include #include #include #include #include int main() { const char* file = "/home/xliu/work/exome/a.bam"; struct stat st; stat(file, &st); char buf[65536

Re: PATCH: pread() return non-zero if read beyond end of file

2017-11-06 Thread Xiaofeng Liu via cygwin-patches
, NULL, NULL, &io, buf, count, On Monday, November 6, 2017, 12:23:44 PM PST, Corinna Vinschen wrote: Hi, On Nov  6 19:20, Xiaofeng Liu via cygwin-patches wrote: > pread() return 0 if read beyond end of file in linux, but not zero in cygwin.  > I have a small code to show t

Re: PATCH: pread() return non-zero if read beyond end of file

2017-11-06 Thread Xiaofeng Liu via cygwin-patches
NtReadFile (prw_handle, NULL, NULL, NULL, &io, buf, count,                            On Monday, November 6, 2017, 12:23:44 PM PST, Corinna Vinschen wrote: Hi, On Nov  6 19:20, Xiaofeng Liu via cygwin-patches wrote: > pread() return 0 if read beyond end of file in linux, but not zero i

[PATCH] pread() returns non-zero if read beyond EOF, because NtReadFile returns EOF status but doesn't set information to 0. Need reset io status block before NtReadFile is called, so that pread() w

2017-11-07 Thread Xiaofeng Liu via cygwin-patches
--- winsup/cygwin/fhandler_disk_file.cc |    1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.ccindex bc8fead..525cb32 100644--- a/winsup/cygwin/fhandler_disk_file.cc+++ b/winsup/cygwin/fhandler_disk_file.cc

Re: [PATCH] pread() returns non-zero if read beyond EOF, because NtReadFile returns EOF status but doesn't set information to 0. Need reset io status block before NtReadFile is called, so that pread

2017-11-08 Thread Xiaofeng Liu via cygwin-patches
wrote: > On Nov  7 17:33, Xiaofeng Liu via cygwin-patches wrote: > > --- winsup/cygwin/fhandler_disk_file.cc |    1 + 1 files changed, 1 > > insertions(+), 0 deletions(-) > > diff --git a/winsup/cygwin/fhandler_disk_file.cc > > b/winsup/cygwin/fhandler_disk_file.ccin