Paul Eggert wrote:
> >> int
> >> fchmodat (int dir, char const *file, mode_t mode, int flags)
> >> {
> >> + if (file && *file)
> >> + flags &= ~AT_EMPTY_PATH;
> >> + else if (! (flags & AT_EMPTY_PATH))
> >> + {
> >> + errno = ENOENT;
> >> + return -1;
> >> + }
> >> + else if (! (flags & AT_SYMLINK_NOFOLLOW))
> >> + return fchmod (dir, mode);
> > Shouldn't the last line read
> >
> > return fchmod (dir == AT_FDCWD ? "." : dir, mode);
>
> Thanks, good catch, though the fix isn't quite right. First, fchmod
> needs an int not a string. Second, 'return dir == AT_FDCWD ? chmod (".",
> mode) : fchmod (dir, mode);' wouldn't be quite right either, as the
> chmod would wrongly fail when the working directory is not searchable.
Yeah, I had not thought through all cases and requirements.
Btw, since you are renaming parameters 'int flag' to 'int flags', how
about also renaming 'int dir' to 'int dirfd' ? I am used to declarations
const char *dir;
DIR *dir;
Bruno