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

This commit is contained in:
Alexandre Julliard 2007-01-08 21:34:15 +01:00
parent 6e062a4e08
commit 126bbb3fe3
1 changed files with 5 additions and 0 deletions

View File

@ -184,6 +184,11 @@ static int build_shared_mapping( struct mapping *mapping, int fd,
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;