summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-26 06:17:52 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:04:45 -0500
commitba15d622d3e9d1eaf0b740c1367dee50f4b29e5c (patch)
treeaabe5a159b23829f37957b45fadd4b3e2b6b9565 /source4
parente9820e1b6e62240c5a18fa85e38a99685beed2df (diff)
downloadsamba-ba15d622d3e9d1eaf0b740c1367dee50f4b29e5c.tar.gz
samba-ba15d622d3e9d1eaf0b740c1367dee50f4b29e5c.tar.bz2
samba-ba15d622d3e9d1eaf0b740c1367dee50f4b29e5c.zip
r3241: don't skip the read completely for a zero-length read, as it could give a lock conflict
(This used to be commit 7ce6139f984c72a6347c7a64d95d5278bcf3e868)
Diffstat (limited to 'source4')
-rw-r--r--source4/ntvfs/posix/pvfs_read.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/source4/ntvfs/posix/pvfs_read.c b/source4/ntvfs/posix/pvfs_read.c
index ee750a138f..b36840cb15 100644
--- a/source4/ntvfs/posix/pvfs_read.c
+++ b/source4/ntvfs/posix/pvfs_read.c
@@ -33,6 +33,7 @@ NTSTATUS pvfs_read(struct ntvfs_module_context *ntvfs,
ssize_t ret;
struct pvfs_file *f;
NTSTATUS status;
+ uint32_t maxcnt;
if (rd->generic.level != RAW_READ_READX) {
return ntvfs_map_read(req, rd, ntvfs);
@@ -51,15 +52,14 @@ NTSTATUS pvfs_read(struct ntvfs_module_context *ntvfs,
return NT_STATUS_ACCESS_VIOLATION;
}
- /* this matches w2k3 behaviour for attempted large reads */
- if (rd->readx.in.maxcnt > UINT16_MAX) {
- ret = 0;
- goto done_read;
+ maxcnt = rd->readx.in.maxcnt;
+ if (maxcnt > UINT16_MAX) {
+ maxcnt = 0;
}
-
+
status = pvfs_check_lock(pvfs, f, req->smbpid,
rd->readx.in.offset,
- rd->readx.in.maxcnt,
+ maxcnt,
READ_LOCK);
if (!NT_STATUS_IS_OK(status)) {
return status;
@@ -67,13 +67,12 @@ NTSTATUS pvfs_read(struct ntvfs_module_context *ntvfs,
ret = pread(f->fd,
rd->readx.out.data,
- rd->readx.in.maxcnt,
+ maxcnt,
rd->readx.in.offset);
if (ret == -1) {
return pvfs_map_errno(pvfs, errno);
}
-done_read:
f->position = f->seek_offset = rd->readx.in.offset + ret;
rd->readx.out.nread = ret;