Subject: directory opening/closing behavior
From: chad fowler <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Sat, 17 Nov 2001 15:47:33 -0800 (PST)

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/