Check return of tmpfile(). see #5586

git-svn-id: http://svn.automattic.com/wordpress/trunk@7403 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-03-19 20:36:23 +00:00
parent 81466f4604
commit ca900d471c
2 changed files with 8 additions and 0 deletions

View File

@ -152,6 +152,8 @@ class WP_Filesystem_FTPext{
$type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII;
}
$temp = tmpfile();
if ( ! $temp )
return false;
if( ! @ftp_fget($this->link,$temp,$file,$type,$resumepos) )
return false;
fseek($temp, 0); //Skip back to the start of the file being written to
@ -171,6 +173,8 @@ class WP_Filesystem_FTPext{
$type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII;
}
$temp = tmpfile();
if ( ! $temp )
return false;
fwrite($temp,$contents);
fseek($temp, 0); //Skip back to the start of the file being written to
$ret = @ftp_fput($this->link,$file,$temp,$type);

View File

@ -159,6 +159,8 @@ class WP_Filesystem_ftpsockets{
}
$this->ftp->SetType($type);
$temp = tmpfile();
if ( ! $temp )
return false;
if ( ! $this->ftp->fget($temp, $file) ) {
fclose($temp);
return ''; //Blank document, File does exist, Its just blank.
@ -183,6 +185,8 @@ class WP_Filesystem_ftpsockets{
$this->ftp->SetType($type);
$temp = tmpfile();
if ( ! $temp )
return false;
fwrite($temp,$contents);
fseek($temp, 0); //Skip back to the start of the file being written to
$ret = $this->ftp->fput($file, $temp);