summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-03-13 20:49:57 +0000
committerJeremy Allison <jra@samba.org>2002-03-13 20:49:57 +0000
commitf9af25c4ecaf30ccd9bb01762f65fe93ef566687 (patch)
treeffbe77d45799bee950c3828c9922cd9bae29089c /source3/locking
parent5e3b923124e82b1d19875746676df13cfdb0f918 (diff)
downloadsamba-f9af25c4ecaf30ccd9bb01762f65fe93ef566687.tar.gz
samba-f9af25c4ecaf30ccd9bb01762f65fe93ef566687.tar.bz2
samba-f9af25c4ecaf30ccd9bb01762f65fe93ef566687.zip
Ensure we attempt to lock at least once. Only sleep if time param set.
Jeremy. (This used to be commit 62b80d5c65ae8cf35347ee5c3d21ce1702c6449e)
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/locking.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 8f3e4a278e..1090b0fcbf 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -155,12 +155,16 @@ NTSTATUS do_lock_spin(files_struct *fsp,connection_struct *conn, uint16 lock_pid
int sleeptime = lp_lock_sleep_time();
NTSTATUS status;
+ if (maxj <= 0)
+ maxj = 1;
+
for (j = 0; j < maxj; j++) {
status = do_lock(fsp, conn, lock_pid, count, offset, lock_type);
if (!NT_STATUS_EQUAL(status, NT_STATUS_LOCK_NOT_GRANTED) &&
!NT_STATUS_EQUAL(status, NT_STATUS_FILE_LOCK_CONFLICT))
break;
- usleep(sleeptime);
+ if (sleeptime)
+ usleep(sleeptime);
}
return status;
}