cygwin 1.3.3 - fchdir() problem?

Corinna Vinschen cygwin@cygwin.com
Mon Sep 17 14:16:00 GMT 2001


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 <stdio.h>
 #include <errno.h>
 #include <sys/fcntl.h>
 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
-- 
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Developer mailto:cygwin@cygwin.com
Red Hat, Inc.
--
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/


More information about the Cygwin mailing list

AltStyle によって変換されたページ (->オリジナル) /