diff options
author | Andrew Tridgell <tridge@samba.org> | 1998-09-18 03:00:20 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1998-09-18 03:00:20 +0000 |
commit | 4e784b18899eddd2399a51fa7d8c219560432922 (patch) | |
tree | dbcf7f73a35659b8dfd4e2152ffe0eb53052f3ed /source/smbd/open.c | |
parent | 724b9508c2d15bafdad5912fce702108fdd4cac3 (diff) | |
download | samba-4e784b18899eddd2399a51fa7d8c219560432922.tar.gz |
gto ri of a bunch more #ifdef LARGE_SMB_OFF_T checks by introducing a
SOFF_T() macro for setting an SMB_OFF_T variable
also limited mmap based reads to MAX_MMAP_SIZE. We really can't mmap
2^50 bytes due to virtual address space problems.
Diffstat (limited to 'source/smbd/open.c')
-rw-r--r-- | source/smbd/open.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/source/smbd/open.c b/source/smbd/open.c index a02fe91e683..394c7be3f80 100644 --- a/source/smbd/open.c +++ b/source/smbd/open.c @@ -541,13 +541,15 @@ static void open_file(files_struct *fsp,connection_struct *conn, /* mmap it if read-only */ if (!fsp->can_write) { fsp->mmap_size = file_size(fname); - fsp->mmap_ptr = (char *)mmap(NULL,fsp->mmap_size, - PROT_READ,MAP_SHARED,fsp->fd_ptr->fd,0); - - if (fsp->mmap_ptr == (char *)-1 || !fsp->mmap_ptr) { - DEBUG(3,("Failed to mmap() %s - %s\n", - fname,strerror(errno))); - fsp->mmap_ptr = NULL; + if (fsp->mmap_size < MAX_MMAP_SIZE) { + fsp->mmap_ptr = (char *)mmap(NULL,fsp->mmap_size, + PROT_READ,MAP_SHARED,fsp->fd_ptr->fd,0); + + if (fsp->mmap_ptr == (char *)-1 || !fsp->mmap_ptr) { + DEBUG(3,("Failed to mmap() %s - %s\n", + fname,strerror(errno))); + fsp->mmap_ptr = NULL; + } } } #endif |