Hi Paul,
> found that I had trouble reading the code
That's probably because I prefer the "one code for each platform" approach when
suitable - because when debugging problems I don't like to rely to
$CC ... -E file.c > file.i
to tell me which code is actually enabled -, whereas you seem to prefer a
"global minimum of lines" approach. It's understandable that I find your code
hard to understand and vice versa.
I'm not saying that one is better than the other; just trying to explain why
we find each other's code odd here.
> Instead of making it more complicated still I snipped away everything I
> couldn't figure out the need for, and installed the attached.
>
> Perhaps I went too far and some of the complications need to be brought back,
> but I hope not....
The fchmodat part looks right.
On the other hand, the lchmod part looks wrong: You stripped away the
test $REPLACE_LCHMOD = 1
case. However, the file doc/glibc-functions/lchmod.texi still says
Portability problems fixed by Gnulib:
@itemize
...
@item
This function always fails with @code{errno} set to @code{ENOSYS},
even when the file is not a symbolic link:
GNU/Linux with glibc 2.31.
Overriding the system's lchmod function requires the case REPLACE_LCHMOD=1.
Bruno