View | Details | Raw Unified | Return to bug 426 | Differences between
and this patch

Collapse All | Expand All

(-)../openssh-3.4p1/sftp-client.c (-6 / +9 lines)
Lines 746-752 Link Here
746
       int local_fd, status, num_req, max_req, write_error;
796
       int local_fd, status, num_req, max_req, write_error;
747
       int read_error, write_errno;
797
       int read_error, write_errno;
748
       u_int64_t offset, size;
798
       u_int64_t offset, size;
749
       u_int handle_len, mode, type, id, buflen;
799
       u_int handle_len, mode, type, id, buflen, savemode;
750
       struct request {
800
       struct request {
751
               u_int id;
801
               u_int id;
752
               u_int len;
802
               u_int len;
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));

Return to bug 426