|
Lines 763-773
Link Here
|
| 763 |
return(-1); |
813 |
return(-1); |
| 764 |
/* XXX: should we preserve set[ug]id? */ |
814 |
/* XXX: should we preserve set[ug]id? */ |
| 765 |
if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) |
815 |
if (a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) { |
| 766 |
mode = S_IWRITE | (a->perm & 0777); |
816 |
mode = S_IWRITE | (a->perm & 0777); |
| 767 |
else |
817 |
savemode = (a->perm & 0777); |
|
|
818 |
} |
| 819 |
else { |
| 768 |
mode = 0666; |
820 |
mode = 0666; |
| 769 |
|
821 |
savemode = 0666; |
|
|
822 |
} |
| 770 |
if ((a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) && |
823 |
if ((a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS) && |
| 771 |
(a->perm & S_IFDIR)) { |
824 |
(a->perm & S_IFDIR)) { |
| 772 |
error("Cannot download a directory: %s", remote_path); |
825 |
error("Cannot download a directory: %s", remote_path); |
|
Lines 931-939
Link Here
|
| 931 |
/* Override umask and utimes if asked */ |
984 |
/* Override umask and utimes if asked */ |
| 932 |
#ifdef HAVE_FCHMOD |
985 |
#ifdef HAVE_FCHMOD |
| 933 |
if (pflag && fchmod(local_fd, mode) == -1) |
986 |
if (pflag && fchmod(local_fd, savemode) == -1) |
| 934 |
#else |
987 |
#else |
| 935 |
if (pflag && chmod(local_path, mode) == -1) |
988 |
if (pflag && chmod(local_path, savemode) == -1) |
| 936 |
#endif /* HAVE_FCHMOD */ |
989 |
#endif /* HAVE_FCHMOD */ |
| 937 |
error("Couldn't set mode on \"%s\": %s", local_path, |
990 |
error("Couldn't set mode on \"%s\": %s", local_path, |
| 938 |
strerror(errno)); |
991 |
strerror(errno)); |