patch from jim wilcoxson: raise an error early if chdir will fail.

This commit is contained in:
Robey Pointer 2009-07-19 19:47:53 -07:00
parent 60c6e94e7d
commit e56b36648d
1 changed files with 3 additions and 0 deletions

View File

@ -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):