Right now, gnulib has an lchmod replacement which always calls chmod; this will do the wrong thing if it is ever called on a symlink, but is right for everything else.
(emphasis mine)
Wow.
edit: formatting
]]>man 2 chown shows that there indeed is a lchown system call. Manual for chmod doesn't mention lchmod, it seems to be declared in stat.h, but it's inside __USE_BSD define, not sure how that works. Some info about this: http://lists.gnu.org/archive/html//bug- … 00268.html
lchmod ist defined in unistd.h and is available on BSD as well as Linux (part of X/Open XA UNIX extensions)
]]>Is there a non-dereferencing version of the chown system call (i.e. lchown?).
Yep, looks that way. There's a man page for it.
lchmod looks like a BSD only thing, though.
EDIT:
Ah, guy above me found it first.
What about chmod? Is it even possible to change the permission mode of a symlink? There does not seem to be any non-dereferencing options for the command-line utility.
Thanks.
]]>