Mail Archives: djgpp-workers/2014/04/22/15:44:39
> Date: Tue, 22 Apr 2014 22:27:56 +0300
> From: Ozkan Sezer <sezeroz AT gmail DOT com>
>
> >> I suggest that we chop xstat.c into pieces _and_ change mkdir() too.
> >
> > I see no need to chop, just get _djstat_flags out of there.
> >
>
> OK, then I suggest moving those two flags into a new statbits.c
Maybe just into crt1.c. It's just one int, so doesn't deserve a
separate file, and no one will complain about the code bloat of 4
bytes.
> >> --- mkdir.c 2 Oct 2011 02:40:11 -0000 1.7
> >> +++ mkdir.c 22 Apr 2014 18:50:40 -0000
> >> @@ -73,7 +73,8 @@ do_mkdir:
> >> {
> >> /* see if the directory existed, in which case
> >> we should return EEXIST - DJ */
> >> - if (access(mydirname, D_OK) == 0)
> >> + if ((attr = _chmod(dir_name, 0)) != -1 &&
> >> + attr & 0x10)
> >
> > Not enough: _chmod doesn't resolve symlinks (assuming we want to
> > return EEXIST for symlinks to directories, that is -- what does Posix
> > say?).
> >
>
> On linux, 'man 2 mkdir' says:
> "EEXIST pathname already exists (not necessarily as a directory).
> This includes the case where pathname is a symbolic link, dangling
> or not."
So we need to resolve symlinks.
> Note that what we presently have already resolves the symlinks even
> though we are passing mydirname to access() and not dir_name,
> because access() does resolve symlinks.
Right you are, sorry for the noise.
- Raw text -