https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=cfb21d7d416018cccd58419d4769861c1f0aad2e

commit cfb21d7d416018cccd58419d4769861c1f0aad2e
Author: Takashi Yano <[email protected]>
Date:   Thu Jan 8 21:20:04 2026 +0900

    Cygwin: flock: Remove the unnecessary fdtab lock
    
    There are two more fdtab enumerations using fdtab locking, one is in
    inode_t::del_my_locks(), and the other is in fixup_lockf_after_exec().
    They merely count the file descriptors affected by the corresponding
    lock, so locking fdtab seems unnecessary. The latter runs only during
    execve(), when no other threads exist. Therefore, these two locks are
    redundant. This patch removes them.
    
    Suggested-by: Corinna Vinschen <[email protected]>
    Reviewed-by: Corinna Vinschen <[email protected]>
    Signed-off-by: Takashi Yano <[email protected]>

Diff:
---
 winsup/cygwin/flock.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/flock.cc b/winsup/cygwin/flock.cc
index 221501d65..857762f4a 100644
--- a/winsup/cygwin/flock.cc
+++ b/winsup/cygwin/flock.cc
@@ -379,7 +379,7 @@ inode_t::del_my_locks (long long id, HANDLE fhdl)
       else if (id && lock->lf_id == id)
        {
          int cnt = 0;
-         cygheap_fdenum cfd (true);
+         cygheap_fdenum cfd (false);
          while (cfd.next () >= 0)
            if (cfd->get_unique_id () == lock->lf_id && ++cnt > 1)
              break;
@@ -441,7 +441,7 @@ fixup_lockf_after_exec (bool exec)
     {
       node->notused ();
       int cnt = 0;
-      cygheap_fdenum cfd (true);
+      cygheap_fdenum cfd (false);
       while (cfd.next () >= 0)
        if (cfd->get_dev () == node->i_dev
            && cfd->get_ino () == node->i_ino

Reply via email to