On Tue, Apr 04, 2023 at 05:13:41PM -0700, Junio C Hamano wrote: > * if lstat() succeeds, but the path is *not* a directory; errno is > explicitly set to ENOTDIR. Unfortunately, if lstat(2) failed > with ENOTDIR (e.g. dir_iterator_begin() gets called with a path > whose leading component is not a directory), the caller will also > see ENOTDIR, but the distinction may not matter in practice. I > haven't thought things through. Yeah. The real tragedy here is that there's no way to signal that a file *is* a symbolic link and represent that as an error code in errno. So I think the best that we can do here is to continue to report ENOTDIR, and have the caller figure out what to do with it. Thanks, Taylor