Alexandre Julliard : server: Don' t fail to map a shared section if the final sector is truncated.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jan 8 14:44:37 CST 2007


Module: wine
Branch: master
Commit: 126bbb3fe35b9e32ce8ce2d28a44b0ab6f593d83
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=126bbb3fe35b9e32ce8ce2d28a44b0ab6f593d83

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jan  8 21:34:15 2007 +0100

server: Don't fail to map a shared section if the final sector is truncated.

---

 server/mapping.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/server/mapping.c b/server/mapping.c
index c7eb075..fe99879 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -184,6 +184,11 @@ static int build_shared_mapping( struct
         while (toread)
         {
             long res = pread( fd, buffer + file_size - toread, toread, read_pos );
+            if (!res && toread < 0x200)  /* partial sector at EOF is not an error */
+            {
+                file_size -= toread;
+                break;
+            }
             if (res <= 0) goto error;
             toread -= res;
             read_pos += res;




More information about the wine-cvs mailing list