open /dev/null O_NOFOLLOW fails with ELOOP
Corinna Vinschen
corinna-cygwin@cygwin.com
Wed Dec 21 11:31:41 GMT 2022
Hi Glenn,
On Dec 21 06:15, gs-cygwin.com--- via Cygwin wrote:
> open /dev/null O_NOFOLLOW fails with ELOOP
>
> Windows 10, 64-bit cygwin
>
> Failed with my existing install, then I ran setup.exe, updated to
> latest, and my tests still failed.
>
> a.c
> ---
>
> #include <sys/types.h>
> #include <fcntl.h>
> #include <stdio.h>
>
> int main (void)
> {
> int fd = open("/dev/null", O_RDWR | O_NOFOLLOW, 0);
> if (fd < 0)
> perror("open(/dev/null)");
> return fd;
> }
>
>
> $ gcc a.c ; ./a.exe
> open(/dev/null): Too many levels of symbolic links
>
> While troubleshooting this, there were times where it succeeded and then
> times where it failed, though it failed most of the time. It did not
> fail (or succeed) randomly, but seemingly in streaks.
>
> Trying to start lighttpd seems to run into this bug reliably,
> $ /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
> In the next release of lighttpd, I may end up omitting O_NOFOLLOW
> if __CYGWIN__ is defined.
Thanks for the report. I think I see what's going on, stay tuned.
Thanks,
Corinna
More information about the Cygwin
mailing list