1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

g_lock: check for zero timeout in g_lock_lock()

If the record is already locked check if the requested timeout is zero
and fail directly with NT_STATUS_LOCK_NOT_GRANTED.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2022-03-25 15:50:54 +01:00 committed by Jeremy Allison
parent aa8b0ef8b9
commit 0db39fad9e

View File

@ -1292,6 +1292,10 @@ NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, TDB_DATA key,
return state.status;
}
if (timeval_is_zero(&timeout)) {
return NT_STATUS_LOCK_NOT_GRANTED;
}
/*
* Fall back to the full g_lock_trylock logic,
* g_lock_lock_simple_fn() called above only covers