Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Wed, 8 May 2002 17:57:28 -0400 (EDT) From: Mark Blackburn To: cygwin AT cygwin DOT com Subject: RE: EISDIR EACCES and open in grep Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII I thought I'd throw in a suggestion for my problem with getting open to return EISDIR. It seems that the win32 call CreateFile doesn't distinguish between an access error and an error because you were trying to open a directory as a file. Please take this with a grain of salt since I'm a total cygwin.dll newbie (haven't compiled cygwin yet...) so this may be totally way off base. --- fhandler.cc.bak Tue Feb 19 22:25:00 2002 +++ fhandler.cc Wed May 8 17:49:26 2002 @@ -406,8 +406,19 @@ if (x == INVALID_HANDLE_VALUE) { + WIN32_FIND_DATA find_file_data; if (GetLastError () == ERROR_INVALID_HANDLE) - set_errno (ENOENT); + { + if (INVALID_HANDLE_VALUE != FindFirstFile(get_win32_name (), + &find_file_data)) + { + if (FILE_ATTRIBUTE_DIRECTORY == + find_file_data.dwFileAttributes) + set_errno (EISDIR); + } + else + set_errno (ENOENT); + } else __seterrno (); goto done; -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/