Index: wp-admin/includes/file.php
===================================================================
--- wp-admin/includes/file.php	(revision 17191)
+++ wp-admin/includes/file.php	(working copy)
@@ -537,9 +537,12 @@
 		return new WP_Error('http_404', trim($response['response']['message']));
 	}
 
-	fwrite($handle, $response['body']);
+	$result = fwrite($handle, $response['body']);
 	fclose($handle);
 
+	if ( false === $result || is_int($result) && $result < strlen($response['body']) )
+		return new WP_Error('http_cannot_write', __('Could not write to the temporary file. There may not be enough diskspace.') );
+
 	return $tmpfname;
 }
 
