mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-03 13:00:39 +08:00
a0a25849f9
Commit 80f722e97cf7 ("Cygwin: opendir(3): move ENOTDIR check into main function") introduced a bug in fhandler_virtual handling. While the assertion that path_conv::check() already calls exists() and sets FILE_ATTRIBUTE_DIRECTORY accordingly, the exists() function is called on a fhandler_virtual object created for just this code snippet. The side effect of this is that the fileid member in the calling fhandler_virtual object is not set after path_conv::check(). Move the fhandler_virtual::fileid member to path_conv::_virt_fileid and create matching path_conv::virt_fileid() and fhandler_virtual::fileid() methods. Let path_conv::check() propagate the fileid set in the local fhandler_virtual::exists() call to its own _virt_fileid. Use new fhandler_virtual::fileid() method throughout. Fixes: 80f722e97cf7 ("Cygwin: opendir(3): move ENOTDIR check into main function") Reported-by: Bruce Jerrick <bmj001@gmail.com> Signed-off-by: Corinna Vinschen <corinna@vinschen.de>