aboutsummaryrefslogtreecommitdiffstats
path: root/syscall.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2005-07-27 23:30:53 +0000
committerWayne Davison <wayned@samba.org>2005-07-27 23:30:53 +0000
commitd11f5c6e2b0c813136519e39820055cd73cfe463 (patch)
tree332f34203d269a9e206fbd52d5929306d513878c /syscall.c
parent25007999df5ef5ecb138f34193729e4019ad778c (diff)
downloadandroid_external_rsync-d11f5c6e2b0c813136519e39820055cd73cfe463.tar.gz
android_external_rsync-d11f5c6e2b0c813136519e39820055cd73cfe463.tar.bz2
android_external_rsync-d11f5c6e2b0c813136519e39820055cd73cfe463.zip
- Don't call do_chmod() unless HAVE_CHMOD is defined.
- Made do_chmod() handle symlinks or return 1 if not possible. - We now mask off the mode bits in do_chmod() sing CHMOD_BITS.
Diffstat (limited to 'syscall.c')
-rw-r--r--syscall.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/syscall.c b/syscall.c
index 2f73ba3b..48c7e901 100644
--- a/syscall.c
+++ b/syscall.c
@@ -104,7 +104,11 @@ int do_mknod(char *pathname, mode_t mode, dev_t dev)
|| (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
@@ -137,7 +141,14 @@ int do_chmod(const char *path, mode_t mode)
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;