delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/09/17/17:17:16

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Mon, 17 Sep 2001 22:29:01 +0200
From: Corinna Vinschen <cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: cygwin 1.3.3 - fchdir() problem?
Message-ID: <20010917222901.I10081@cygbert.vinschen.de>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <009101c13f9d$e694a080$5c6706d5 AT uhs> <20010917135636 DOT A22751 AT redhat DOT com> <000901c13fb3$667abc20$35e606d5 AT uhs>
Mime-Version: 1.0
User-Agent: Mutt/1.2.5i
In-Reply-To: <000901c13fb3$667abc20$35e606d5@uhs>; from usteinfeld@gmx.net on Mon, Sep 17, 2001 at 09:59:30PM +0200

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 AT cygwin DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019