On 2/13/20 7:46 PM, Bruno Haible wrote:

Here is a proposed patch:

Thanks, looks good.

2) Also the discussion what is the "right" behaviour is specific to Linux.
The code in the '#else' case

   if (S_ISLNK (st.st_mode))
       close (fd);
       errno = EOPNOTSUPP;
       return -1;

will surely upset users on BSD systems, where symlinks are intended to have
permission bits.

Because of the Autoconf tests, that code should be executed only on platforms where lchmod fails (or does not exist), whould shouldn't occur on BSD systems. Still, I take your point that the code is confusing. Perhaps lchmod.m4 and fchmodat.m4 should define a symbol HAVE_LCHMOD_BUG_WITH_NON_SYMLINKS and the C code could refer to that. The resulting machine code would be the same as now, but the cause-and-effect would be clearer.

Reply via email to