Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <00a101c14031$7a3bd040$816136d5@uhs> From: "Uwe H. Steinfeld" To: "Corinna Vinschen" References: <009101c13f9d$e694a080$5c6706d5 AT uhs> <20010917135636 DOT A22751 AT redhat DOT com> <000901c13fb3$667abc20$35e606d5 AT uhs> <20010917222901 DOT I10081 AT cygbert DOT vinschen DOT de> Subject: Re: cygwin 1.3.3 - fchdir() problem? Date: Tue, 18 Sep 2001 12:50:12 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 open (somedir, O_RDONLY) always gives error 13 (permission denied) if somedir exists, and error 2 (no such file or directory) otherwise. This is standard Win32 (mis-)behavior. From MS documentation: A return value of -1 indicates an error, in which case errno is set to one of the following values: EACCES Tried to open read-only file for writing, or file's sharing mode does not allow specified operations, or given path is directory Danke Uwe ----- Original Message ----- From: "Corinna Vinschen" To: Sent: Monday, September 17, 2001 10:29 PM Subject: Re: cygwin 1.3.3 - fchdir() problem? > On Mon, Sep 17, 2001 at 09:59:30PM +0200, Uwe H. Steinfeld wrote: > > I tracked my problem down to the following: > > when fchdir is defined and the directory to be created or removed is not a > > subdirectory of the current working directory, fileutils try to do an > > open (".", O_RDONLY | O_DIRECTORY) > > and that is never successful in Cygwin/Win32. > > Beep! Try this: > > #include > #include > #include > > int > main (int argc, char **argv) > { > int fd; > > if ((fd = open (".", O_RDONLY)) < 0) > printf ("NOPE: %d\n", errno); > else > { > printf ("YEP\n"); > close (fd); > } > return 0; > } > > O_DIRECTORY isn't defined on Cygwin. According to the Linux man > pages it's a Linux invention to avoid denial-of-service problems > with opendir(). Especially it "should not be used outside of the > implementation of opendir." > > Corinna -- 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/