File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -184,12 +184,18 @@ cdef class SFTP:
184
184
:raises: :py:class:`ssh2.exceptions.SFTPHandleError` on errors opening
185
185
file.
186
186
"""
187
- cdef c_sftp.LIBSSH2_SFTP_HANDLE * _handle
187
+ cdef c_sftp.LIBSSH2_SFTP_HANDLE * _handle = NULL
188
188
cdef bytes b_filename = to_bytes(filename)
189
189
cdef char * _filename = b_filename
190
+ cdef int rc = c_ssh2.LIBSSH2_ERROR_EAGAIN
191
+
190
192
with nogil:
191
- _handle = c_sftp.libssh2_sftp_open(
192
- self ._sftp, _filename, flags, mode)
193
+ while _handle == NULL and rc == c_ssh2.LIBSSH2_ERROR_EAGAIN:
194
+ _handle = c_sftp.libssh2_sftp_open(
195
+ self ._sftp, _filename, flags, mode)
196
+
197
+ rc = c_ssh2.libssh2_session_last_errno(self ._session._session)
198
+
193
199
if _handle is NULL :
194
200
raise SFTPHandleError(
195
201
" Could not open file %s - error code %s - %s " , filename,
You can’t perform that action at this time.
0 commit comments