* mmap.cc (mmap): Assign 'fh' from cygheap_fdget. Use 'fh' everywhere.

This commit is contained in:
Christopher Faylor 2001-10-16 14:04:26 +00:00
parent f636c08124
commit 5a23087628
2 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2001-10-16 Christopher Faylor <cgf@redhat.com>
* mmap.cc (mmap): Assign 'fh' from cygheap_fdget. Use 'fh' everywhere.
2001-10-15 Christopher Faylor <cgf@redhat.com> 2001-10-15 Christopher Faylor <cgf@redhat.com>
* cygerrno.h (set_errno): Define more informative version of this * cygerrno.h (set_errno): Define more informative version of this

View File

@ -445,7 +445,7 @@ mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t off)
DWORD gran_off = off & ~(granularity - 1); DWORD gran_off = off & ~(granularity - 1);
DWORD gran_len = howmany (len, granularity) * granularity; DWORD gran_len = howmany (len, granularity) * granularity;
fhandler_base *fh = NULL; fhandler_base *fh;
caddr_t base = addr; caddr_t base = addr;
HANDLE h; HANDLE h;
@ -459,14 +459,15 @@ mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t off)
ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap"); ReleaseResourceLock(LOCK_MMAP_LIST, READ_LOCK | WRITE_LOCK, "mmap");
return MAP_FAILED; return MAP_FAILED;
} }
if (cfd->get_device () == FH_DISK) fh = cfd;
if (fh->get_device () == FH_DISK)
{ {
DWORD fsiz = GetFileSize (fh->get_handle (), NULL); DWORD fsiz = GetFileSize (fh->get_handle (), NULL);
fsiz -= gran_off; fsiz -= gran_off;
if (gran_len > fsiz) if (gran_len > fsiz)
gran_len = fsiz; gran_len = fsiz;
} }
else if (cfd->get_device () == FH_ZERO) else if (fh->get_device () == FH_ZERO)
/* mmap /dev/zero is like MAP_ANONYMOUS. */ /* mmap /dev/zero is like MAP_ANONYMOUS. */
fd = -1; fd = -1;
} }