mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-26 11:37:33 +00:00
- 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:
parent
034ec72ade
commit
0531f713ab
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user