summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-08-26 19:39:40 +0000
committerJeremy Allison <jra@samba.org>2001-08-26 19:39:40 +0000
commit4a3f07456d0a04b84916a99af6ce1cbe65e0370c (patch)
tree948e8c9eed082ddb2b7443806f0f18ee9e27a489 /source3
parent10c240ef977333e3ad0f340961c5d4a807d35144 (diff)
downloadsamba-4a3f07456d0a04b84916a99af6ce1cbe65e0370c.tar.gz
samba-4a3f07456d0a04b84916a99af6ce1cbe65e0370c.tar.bz2
samba-4a3f07456d0a04b84916a99af6ce1cbe65e0370c.zip
Ignore locks of length zero as they mean different things in Win32
and POSIX. Jeremy. (This used to be commit bd9cbf4c6883c1a39f28db8afa7cc0bd04b1b09f)
Diffstat (limited to 'source3')
-rw-r--r--source3/locking/posix.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index 2a6f2be562..6a621200ca 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -107,10 +107,12 @@ static BOOL add_fd_to_close_entry(files_struct *fsp)
tp = Realloc(dbuf.dptr, dbuf.dsize + sizeof(int));
if (!tp) {
DEBUG(0,("add_fd_to_close_entry: Realloc fail !\n"));
- if (dbuf.dptr) free(dbuf.dptr);
+ if (dbuf.dptr)
+ free(dbuf.dptr);
return False;
- }
- else dbuf.dptr = tp;
+ } else
+ dbuf.dptr = tp;
+
memcpy(dbuf.dptr + dbuf.dsize, &fsp->fd, sizeof(int));
dbuf.dsize += sizeof(int);
@@ -378,8 +380,8 @@ static BOOL add_posix_lock_entry(files_struct *fsp, SMB_OFF_T start, SMB_OFF_T s
if (!tp) {
DEBUG(0,("add_posix_lock_entry: Realloc fail !\n"));
goto fail;
- }
- else dbuf.dptr = tp;
+ } else
+ dbuf.dptr = tp;
memcpy(dbuf.dptr + dbuf.dsize, &pl, sizeof(pl));
dbuf.dsize += sizeof(pl);
@@ -580,6 +582,17 @@ static BOOL posix_lock_in_range(SMB_OFF_T *offset_out, SMB_OFF_T *count_out,
#endif /* !LARGE_SMB_OFF_T || HAVE_BROKEN_FCNTL64_LOCKS */
/*
+ * POSIX locks of length zero mean lock to end-of-file.
+ * Win32 locks of length zero are point probes. Ignore
+ * any Win32 locks of length zero. JRA.
+ */
+
+ if (count == (SMB_OFF_T)0) {
+ DEBUG(10,("posix_lock_in_range: count = 0, ignoring.\n"));
+ return False;
+ }
+
+ /*
* If the given offset was > max_positive_lock_offset then we cannot map this at all
* ignore this lock.
*/