- close local file if one is being used and if get() would return prematurely (thanks, Sascha.Pfalz!)

git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@181 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
Jim Wigginton 2011-10-14 05:46:18 +00:00
parent 034ec72ade
commit 0531f713ab
1 changed files with 10 additions and 0 deletions

View File

@ -1464,6 +1464,9 @@ class Net_SFTP extends Net_SSH2 {
while ($read < $size) {
$packet = pack('Na*N3', strlen($handle), $handle, 0, $read, 1 << 20);
if (!$this->_send_sftp_packet(NET_SFTP_READ, $packet)) {
if ($local_file !== false) {
fclose($fp);
}
return false;
}
@ -1484,10 +1487,17 @@ class Net_SFTP extends Net_SSH2 {
break 2;
default:
user_error('Expected SSH_FXP_DATA or SSH_FXP_STATUS', E_USER_NOTICE);
if ($local_file !== false) {
fclose($fp);
}
return false;
}
}
if ($local_file !== false) {
fclose($fp);
}
if (!$this->_send_sftp_packet(NET_SFTP_CLOSE, pack('Na*', strlen($handle), $handle))) {
return false;
}