delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/11/17/18:49:01

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
Message-ID: <20011117234733.6316.qmail@web13904.mail.yahoo.com>
Date: Sat, 17 Nov 2001 15:47:33 -0800 (PST)
From: chad fowler <chadfowler AT yahoo DOT com>
Subject: directory opening/closing behavior
To: cygwin AT cygwin DOT com
Cc: chadfowler AT yahoo DOT com
MIME-Version: 1.0

Hello, again.  I have a question about the behavior of
opening and closing directories.  I've noticed some
behavior that's inconsistent between Linux and Cygwin,
and I'm not sure if it's expected.  It has to do with
trying to mkdir a directory that still has an open
file handle from a previous opendir call.  The
following program demonstrates it:

<code_sample>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>

int main(void)
{
        int rc;
        extern int errno;
        rc = mkdir("_blah", 0777);
        printf("mkdir %d\n", rc);

        rc = opendir("_blah");
        printf("opendir %d\n", rc);

        rc = rmdir("_blah");
        printf("rmdir %d\n", rc);

        rc = mkdir("_blah", 0777);
        printf("mkdir %d\n", rc);
        printf("errno: %d\n", errno);
}
</code_sample>

Cygwin output:
mkdir 0
opendir 167839552
rmdir 0
mkdir -1
errno: 13

Linux output:
mkdir 0
opendir 134518696
rmdir 0
mkdir 0
errno: 38

After having run, the directory "_blah" exists in
Linux but doesn't exist in Cygwin.

What's the expected behavior?  Is this something
classifiable as a bug?  It is obviously good
programming practice to close what you open, but it
concerns me that the behavior is different between
platforms and that the error doesn't happen on rmdir,
but only on mkdir.

__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

--
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