https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c983aa48798dc7adc165862de4b89a6e49b97bdd

commit c983aa48798dc7adc165862de4b89a6e49b97bdd
Author: Corinna Vinschen <[email protected]>
Date:   Wed Nov 8 13:30:42 2017 +0100

    cygwin: fhandler_disk_file::pread: always print debug info on return
    
    Signed-off-by: Corinna Vinschen <[email protected]>

Diff:
---
 winsup/cygwin/fhandler_disk_file.cc | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/fhandler_disk_file.cc 
b/winsup/cygwin/fhandler_disk_file.cc
index 2e4cf49..0b99c49 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -1541,14 +1541,20 @@ fhandler_disk_file::pread (void *buf, size_t count, 
off_t offset)
          if (status == (NTSTATUS) STATUS_ACCESS_VIOLATION)
            {
              if (is_at_eof (prw_handle))
-               return 0;
+               {
+                 res = 0;
+                 goto out;
+               }
              switch (mmap_is_attached_or_noreserve (buf, count))
                {
                case MMAP_NORESERVE_COMMITED:
                  status = NtReadFile (prw_handle, NULL, NULL, NULL, &io,
                                       buf, count, &off, NULL);
                  if (NT_SUCCESS (status))
-                   return io.Information;
+                   {
+                     res = io.Information;
+                     goto out;
+                   }
                  break;
                case MMAP_RAISE_SIGBUS:
                  raise (SIGBUS);
@@ -1579,6 +1585,7 @@ non_atomic:
            res = -1;
        }
     }
+out:
   debug_printf ("%d = pread(%p, %ld, %D)\n", res, buf, count, offset);
   return res;
 }

Reply via email to