Cygwin: flock: Fix overlap handling in lf_setlock() and lf_clearlock()
commit8dee07a1f12682307be07e12a7fd8d5c8ecc1e2b
authorTakashi Yano <takashi.yano@nifty.ne.jp>
Fri, 15 Nov 2024 12:58:22 +0000 (15 21:58 +0900)
committerTakashi Yano <takashi.yano@nifty.ne.jp>
Wed, 20 Nov 2024 12:19:15 +0000 (20 21:19 +0900)
tree9bdce08e55a73e5159c38f1f92f3393bd21a6e46
parente7ef920d7d0dcff8cfe7a0c914f803b8c78900bb
Cygwin: flock: Fix overlap handling in lf_setlock() and lf_clearlock()

Currently, create_lock_obj() can create multiple locks with the same
lock range that have different version number. However, lf_setlock()
and lf_clearlock() cannot handle this case appropriately. With this
patch, make lf_setlock() and lf_clearlock() find overlap again even
when ovcase = 1 (lock and overlap have the same lock range).

Addresses: https://cygwin.com/pipermail/cygwin/2024-November/256750.html
Fixes: 2e560a092c1c ("* flock.cc (LOCK_OBJ_NAME_LEN): Change to accommodate extra lf_ver field.")
Reported-by: Sebastian Feld <sebastian.n.feld@gmail.com>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
winsup/cygwin/flock.cc
winsup/cygwin/release/3.5.5