fchmodat(AT_SYMLINK_NOFOLLOW) should work for non-symlinks
fchmodat(AT_SYMLINK_NOFOLLOW) always returns
EOPNOTSUPP. However, it should succeed if the object is not a symlink and fail if the object is a symlink.
fchmodat(2) man page says this:
The fchmodat() function behaves similarly to chmod(), except when path is a relative path, it is resolved relative to the directory specified by filedes. If filedes has the value AT_FDCWD, then path will be resolved relative to the current working directory. The argument flag should be zero, but may include the value AT_SYMLINK_NOFOLLOW, which indicates that if path refers to a symbolic link, then permissions should be changed on the symbolic link itself. However, changing permissions of symbolic links is not supported on illumos, and will result in an error.
No data to display