Mail Archives: cygwin/2001/11/18/08:17:24
Thanks, Katherina. But, I was actually trying to
demonstrate the difference in behavior when closedir
*isn't* called. I intentially left closedir() out of
my example program. So, Corrina is probably right.
Thanks to both of you (Katherina and Corrina),
Chad
--- Katherina O'Connor <oconnor AT firemail DOT de> wrote:
> > Exactly what you've described. It's a
> > Windows feature which isn't POSIX compatible
> > and for which a workaround would be
> > extremly difficult.
>
> Sorry, this isn't a "Windows feature" but
> POSIX compatible and a workaround would be
> extremly simple, because Chad Fowler made
> a simple mistake: he forgotten to call
> closedir() before rmdir():
>
> #include <stdio.h>
> #include <errno.h>
> #include <unistd.h>
> #include <sys/types.h>
> #include <sys/stat.h>
>
> /* (1) */
> #include <sys/dirent.h>
>
> int main(void)
> {
> int rc;
> extern int errno;
>
> /* (2) */
> DIR* pDIR;
>
> rc = mkdir("_blah", 0777);
> printf("mkdir %d\n", rc);
>
> pDIR = opendir("_blah");
> printf("opendir %d\n", ( long ) pDIR);
>
> /* (3) */
> rc = closedir( pDIR );
> printf("closedir %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);
> }
>
> #if 0
>
> Cygwin output:
> mkdir 0
> opendir 167839600
> closedir 0
> rmdir 0
> mkdir 0
> errno: 0
>
> Linux output:
> mkdir 0
> opendir 134518696
> rmdir 0
> mkdir 0
> errno: 38
>
> #endif
>
> ----- Original Message -----
> From: "Corinna Vinschen" <cygwin AT cygwin DOT com>
> To: <cygwin AT cygwin DOT com>
> Sent: Sunday, November 18, 2001 10:12 AM
> Subject: Re: directory opening/closing behavior
>
>
> > On Sat, Nov 17, 2001 at 03:47:33PM -0800, chad
> fowler wrote:
> > > 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?
> >
> > Exactly what you've described. It's a Windows
> feature which
> > isn't POSIX compatible and for which a workaround
> would be
> > extremly difficult.
> >
> > 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/
> >
> >
> >
> >
>
______________________________________________________
> Kein Schwein klickt mich an? Tragen Sie Ihre Site
> doch einfach im
> Fireballkatalog ein!
> http://www.fireball.de/katalogeintrag.html
>
>
>
> > --
> 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/
__________________________________________________
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 -