patch from jim wilcoxson: raise an error early if chdir will fail.
This commit is contained in:
parent
60c6e94e7d
commit
e56b36648d
|
@ -23,6 +23,7 @@ Client-mode SFTP support.
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
import errno
|
import errno
|
||||||
import os
|
import os
|
||||||
|
import stat
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import weakref
|
import weakref
|
||||||
|
@ -507,6 +508,8 @@ class SFTPClient (BaseSFTP):
|
||||||
|
|
||||||
@since: 1.4
|
@since: 1.4
|
||||||
"""
|
"""
|
||||||
|
if not S_ISDIR(self.stat(path).st_mode):
|
||||||
|
raise SFTPError(errno.ENOTDIR, "%s: %s" % (os.strerror(errno.ENOTDIR), path))
|
||||||
self._cwd = self.normalize(path)
|
self._cwd = self.normalize(path)
|
||||||
|
|
||||||
def getcwd(self):
|
def getcwd(self):
|
||||||
|
|
Loading…
Reference in New Issue