scandirat return dirents of parent dir

Thomas Wolff
Tue Jul 4 12:41:00 GMT 2017

On 04.07.2017 13:09, comic fans wrote:
> Hello:
>       I've found this problem when compile
> casync( in cygwin,workflow to
> trigger this :
>      rootfd=open(".",O_CLOEXEC|O_RDONLY|O_NOCTTY);
>      scandirat(rootfd,".", firstLevelDirEnts......);
>      foreach dirent in firstLevelDirEnts:
>           if dirent is dir:
>               subdirfd=openat(rootfd,
>                    dirent->d_name,O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
>               scandirat(subdirfd,".",  secondLevelDirEnts......);
>       at this time, secondLevelDirEnts should be files in subdir, but
> in cygwin, secondLevelDirEnts is just same as firstLevelDirEnts.
>        This problem didn't happen in linux , nor win10 WSL,  but
> happens in both cygwin/msys2.
It would be nice to provide a complete, compilable test case, please.
It is unclear what you mean by "secondLevelDirEnts is just same" because 
that's different things inside a loop.
Did you consider that one of the entries is ".."?

Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list