delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
X-WM-Posted-At: | avacado.atomice.net; Thu, 9 May 02 21:39:30 +0100 |
Message-ID: | <04e801c1f799$9e7354e0$0100a8c0@advent02> |
From: | "Chris January" <chris AT atomice DOT net> |
To: | <cygwin AT cygwin DOT com> |
References: | <3CDAD4F4 DOT BC86A5BA AT cistron DOT nl> |
Subject: | Re: EISDIR EACCES and open in grep |
Date: | Thu, 9 May 2002 21:39:30 +0100 |
MIME-Version: | 1.0 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2600.0000 |
> I have been trying to chase the same problem (grep -R does not > work on W9x) during the last few days. > On WNT/W2K/XP the code works because CreateFile is called with > the FILE_FLAG_BACKUP_SEMANTICS bit set in file_attributes > (lines 371,372 in fhandler.cc). > On W9x you just get Permission Denied (EACCESS). > MSDN documents that opening directories this way is only supported > on WNT/W2K/XP. > > The branch taken in the code is *not* the > 'if (GetLastError () == ERROR_INVALID_HANDLE)' > but the 'else __seterrno ();', which sets EACCESS. > Found that by tracing with gdb through a debug version > of cygwin1.dll while running 'grep -R'. > So I believe your fix is applied to the wrong branch > of the if statement. > Probably the fix should also be guarded with a check for W9x. > > Related to this: > What is the precise semantics for open(2), read(2) on directories > in POSIX? > Or in other words, if open(2) on a dir succeeds what should read(2) > on a directory do ? See: http://www.opengroup.org/onlinepubs/007908799/xsh/read.html Assuming the only error is trying to read form the directory, it should return: [EISDIR] The fildes argument refers to a directory and the implementation does not allow the directory to be read using read(), pread() or readv(). The readdir() function should be used instead. EINVAL is probably the best error to return from open() if the system doesn't support opening of directories. Chris -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |