Re: [PATCH v2] Cygwin: open: Unlock fdtab before open_with_arch()

Takashi Yano <[email protected]> Sat, 18 Jul 2026 19:23:23 +0900
Newsgroups gmane.os.cygwin.patches
Message-ID <[email protected]>
Hi Mark,

On Fri, 17 Jul 2026 23:16:46 -0700 (PDT)
Mark Geisert wrote:
> Hi Takashi,
> I agree with your comments on my comments. As a check against regression, 
> could you please run Christian's OPEN_MAX STC on your patched system when 
> you have a chance?  Here's the STC in case you don't have it...
> ----8<----
> #include <errno.h>
> #include <fcntl.h>
> #include <stdio.h>
> #include <sys/stat.h>
> 
> 
> int main()
> {
>     for (int i = 0; i < 10000; i++) {
>       char name[32];
>       snprintf(name, sizeof(name), "file-%04d.tmp", i);
>       errno = 0;
>       int fd = open(name, O_WRONLY | O_CREAT | O_EXCL, 0666);
>       if (fd >= 0)
>         continue;
>       printf("open(%s, ...)=%d (errno=%d)\n", name, fd, errno);
>       struct stat st;
>       printf("stat(%s, ...)=%d\n", name, stat(name, &st));
>       break;
>     }
>     return 0;
> }
> ---->8----
> Success is indicated by a report of error 24 when attempting to create 
> file-3197.tmp. Don't forget to delete the 3196 file-*.tmp files after.

Actually, I already tested Christian's test case and got:
open(file-3197.tmp, ...)=-1 (errno=24)
stat(file-3197.tmp, ...)=-1


> If that test works your patch is GTG as far as I'm concerned. I believe it 
> should go to both 3.6.11 and 3.7.0.

Will do. Thanks!

-- 
Takashi Yano <[email protected]>