Re: [PATCH] Cygwin: open: Add missing unlock on error
Mark Geisert <[email protected]> Mon, 3 Aug 2026 01:52:29 -0700
| Newsgroups | gmane.os.cygwin.patches |
|---|---|
| Message-ID | <[email protected]> |
Hi Takashi,
On 8/2/2026 8:22 PM, Takashi Yano wrote:
> the commit 524d75ff7398 ("Cygwin: open: Unlock fdtab before open_
> with_arch()") introduced a bug that fdtab lock was not unlocked
> when new fd cannot be allocated due to an error.
>
> This patch adds missing unlock for fdtab lock on error.
>
> Fixes: 524d75ff7398 ("Cygwin: open: Unlock fdtab before open_with_arch()")
> Suggested-by: Johannes Schindelin <[email protected]>
> Signed-off-by: Takashi Yano <[email protected]>
> Reviewed-by:
> ---
> winsup/cygwin/syscalls.cc | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
> index e3ba8c65c..8373482e9 100644
> --- a/winsup/cygwin/syscalls.cc
> +++ b/winsup/cygwin/syscalls.cc
> @@ -1554,7 +1554,10 @@ open (const char *unix_path, int flags, ...)
> cygheap->fdtab.lock();
> fd = cygheap->fdtab.find_unused_handle ();
> if (fd < 0)
> - __leave; /* errno already set */
> + {
> + cygheap->fdtab.unlock();
> + __leave; /* errno already set */
> + }
> cygheap->fdtab[fd] = fh; /* tentative setting to mark as used */
> cygheap->fdtab.unlock();
>
This patch LGTM. Apologies for not catching this in my review.
Thanks & Regards,
..mark