- stat() should probably not say whether or not the target file is a symlink - presumably that's something only lstat() should do

git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@163 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
Jim Wigginton 2011-06-01 04:24:16 +00:00
parent 893695d7f3
commit 48494b64c8

View File

@ -771,7 +771,15 @@ class Net_SFTP extends Net_SSH2 {
return false;
}
return $this->_identify_type($filename, NET_SFTP_STAT, NET_SFTP_LSTAT);
$stat = $this->_stat($filename, NET_SFTP_STAT);
$pwd = $this->pwd;
$stat['type'] = $this->chdir($filename) ?
NET_SFTP_TYPE_DIRECTORY :
NET_SFTP_TYPE_REGULAR;
$this->pwd = $pwd;
return $stat;
}
/**
@ -794,7 +802,20 @@ class Net_SFTP extends Net_SSH2 {
return false;
}
return $this->_identify_type($filename, NET_SFTP_LSTAT, NET_SFTP_STAT);
$lstat = $this->_stat($filename, NET_SFTP_LSTAT);
$stat = $this->_stat($filename, NET_SFTP_STAT);
if ($lstat != $stat) {
return array_merge($lstat, array('type' => NET_SFTP_TYPE_SYMLINK));
}
$pwd = $this->pwd;
$lstat['type'] = $this->chdir($filename) ?
NET_SFTP_TYPE_DIRECTORY :
NET_SFTP_TYPE_REGULAR;
$this->pwd = $pwd;
return $lstat;
}
/**