~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/stub_sftp.py

  • Committer: John Arbash Meinel
  • Date: 2005-12-02 02:09:27 UTC
  • mto: (1185.50.19 bzr-jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1532.
  • Revision ID: john@arbash-meinel.com-20051202020927-0708e0ef7f7c5923
Setting binary flags for sftp.

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
    def open(self, path, flags, attr):
95
95
        path = self._realpath(path)
96
96
        try:
 
97
            flags |= os.O_BINARY
97
98
            fd = os.open(path, flags)
98
99
        except OSError, e:
99
100
            return SFTPServer.convert_errno(e.errno)
100
101
        if (flags & os.O_CREAT) and (attr is not None):
101
102
            SFTPServer.set_file_attr(path, attr)
102
103
        if flags & os.O_WRONLY:
103
 
            fstr = 'w'
 
104
            fstr = 'wb'
104
105
        elif flags & os.O_RDWR:
105
 
            fstr = 'r+'
 
106
            fstr = 'rb+'
106
107
        else:
107
108
            # O_RDONLY (== 0)
108
 
            fstr = 'r'
 
109
            fstr = 'rb'
109
110
        try:
110
111
            f = os.fdopen(fd, fstr)
111
112
        except OSError, e: