- Made do_chmod() handle symlinks or return 1 if not possible.
- We now mask off the mode bits in do_chmod() sing CHMOD_BITS.
|| (bind(sock, (struct sockaddr*)&saddr, sizeof saddr)) < 0)
return -1;
close(sock);
+#ifdef HAVE_CHMOD
return do_chmod(pathname, mode);
+#else
+ return 0;
+#endif
}
#endif
#ifdef HAVE_MKNOD
int code;
if (dry_run) return 0;
RETURN_ERROR_IF_RO_OR_LO;
- code = chmod(path, mode);
+ if (S_ISLNK(mode)) {
+#ifdef HAVE_LCHMOD
+ code = lchmod(path, mode & CHMOD_BITS);
+#else
+ code = 1;
+#endif
+ } else
+ code = chmod(path, mode & CHMOD_BITS);
if (code != 0 && preserve_perms)
return code;
return 0;