summaryrefslogtreecommitdiffstats
path: root/toolbox/cp/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'toolbox/cp/utils.c')
-rw-r--r--toolbox/cp/utils.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/toolbox/cp/utils.c b/toolbox/cp/utils.c
index b682bbe..9d0390f 100644
--- a/toolbox/cp/utils.c
+++ b/toolbox/cp/utils.c
@@ -380,10 +380,11 @@ copy_special(struct stat *from_stat, int exists)
int
setfile(struct stat *fs, int fd)
{
- int rval, islink;
+ int rval = 0;
+#ifndef ANDROID
+ int islink = S_ISLNK(fs->st_mode);
+#endif
- rval = 0;
- islink = S_ISLNK(fs->st_mode);
fs->st_mode &= S_ISUID | S_ISGID | S_IRWXU | S_IRWXG | S_IRWXO;
/*
@@ -401,13 +402,13 @@ setfile(struct stat *fs, int fd)
fs->st_mode &= ~(S_ISUID | S_ISGID);
}
#ifdef ANDROID
- if (fd ? fchmod(fd, fs->st_mode) : chmod(to.p_path, fs->st_mode)) {
+ if (fd ? fchmod(fd, fs->st_mode) : chmod(to.p_path, fs->st_mode)) {
#else
- if (fd ? fchmod(fd, fs->st_mode) : lchmod(to.p_path, fs->st_mode)) {
+ if (fd ? fchmod(fd, fs->st_mode) : lchmod(to.p_path, fs->st_mode)) {
#endif
- warn("chmod: %s", to.p_path);
- rval = 1;
- }
+ warn("chmod: %s", to.p_path);
+ rval = 1;
+ }
#ifndef ANDROID
if (!islink && !Nflag) {