1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-02 00:22:11 +03:00

Ensure we attempt to lock at least once. Only sleep if time param set.

Jeremy.
(This used to be commit 62b80d5c65)
This commit is contained in:
Jeremy Allison
2002-03-13 20:49:57 +00:00
parent 5e3b923124
commit f9af25c4ec

View File

@ -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;
}