diff options
author | Andrew Tridgell <tridge@samba.org> | 2002-03-15 09:51:37 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2002-03-15 09:51:37 +0000 |
commit | 7d4378cc892550465b75aae563cd6f7ea1608c21 (patch) | |
tree | 1817ebeaf458b99ca423dd5e426672b4cc9fe263 /source3/locking | |
parent | 6a359cca8eacfc049b1ab9e98778dcf817bb1b42 (diff) | |
download | samba-7d4378cc892550465b75aae563cd6f7ea1608c21.tar.gz samba-7d4378cc892550465b75aae563cd6f7ea1608c21.tar.bz2 samba-7d4378cc892550465b75aae563cd6f7ea1608c21.zip |
if our lock spin code fails then return the first error code, not the
last one. This is what caused the lock1 and lock2 tests to fail.
(This used to be commit e7ae8003cb4fdc93db5f842754884a6d2ec93dc0)
Diffstat (limited to 'source3/locking')
-rw-r--r-- | source3/locking/locking.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 7a2e8cf1d7..6efe4a73d7 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -153,20 +153,27 @@ NTSTATUS do_lock_spin(files_struct *fsp,connection_struct *conn, uint16 lock_pid { int j, maxj = lp_lock_spin_count(); int sleeptime = lp_lock_sleep_time(); - NTSTATUS status; + NTSTATUS status, ret; if (maxj <= 0) maxj = 1; + ret = NT_STATUS_OK; /* to keep dumb compilers happy */ + 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; + !NT_STATUS_EQUAL(status, NT_STATUS_FILE_LOCK_CONFLICT)) { + return status; + } + /* if we do fail then return the first error code we got */ + if (j == 0) { + ret = status; + } if (sleeptime) sys_usleep(sleeptime); } - return status; + return ret; } /**************************************************************************** |