summaryrefslogtreecommitdiff
path: root/ucb/source/ucp/ftp/ftpurl.cxx
diff options
context:
space:
mode:
authorAriel Constenla-Haile <arielch@apache.org>2013-06-01 17:16:49 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-06-04 11:09:20 +0100
commit8de6167e36506a5cba21f6a35d4f064e9c9ea368 (patch)
tree33cf12274da8ff1f4bfeda2ea7c5d456bf4d34b9 /ucb/source/ucp/ftp/ftpurl.cxx
parent39e21050fe9e47b0496b0f4cc9e85f6577f0f6ce (diff)
Resolves: #i122273# - Avoid using tmpfile()
(cherry picked from commit c4ef17d5e2844ca8d2459a3bfa1f91d99ac297f2) Conflicts: ucb/source/ucp/ftp/ftpcfunc.cxx ucb/source/ucp/ftp/ftpinpstr.cxx ucb/source/ucp/ftp/ftpinpstr.hxx ucb/source/ucp/ftp/ftpurl.cxx Change-Id: I267a9191f9b922380bef8653ac74543662ebf3ef
Diffstat (limited to 'ucb/source/ucp/ftp/ftpurl.cxx')
-rw-r--r--ucb/source/ucp/ftp/ftpurl.cxx26
1 files changed, 15 insertions, 11 deletions
diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx
index ecee9edbcffe..50309e9d37f9 100644
--- a/ucb/source/ucp/ftp/ftpurl.cxx
+++ b/ucb/source/ucp/ftp/ftpurl.cxx
@@ -389,7 +389,7 @@ namespace ftp {
CURLOPT_URL, \
urlParAscii.getStr());
-FILE* FTPURL::open()
+oslFileHandle FTPURL::open()
throw(curl_exception)
{
if(m_aPathSegmentVec.empty())
@@ -400,18 +400,22 @@ FILE* FTPURL::open()
SET_CONTROL_CONTAINER;
OUString url(ident(false,true));
SET_URL(url);
- FILE *res = tmpfile();
- curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,file_write);
- curl_easy_setopt(curl,CURLOPT_WRITEDATA,res);
- curl_easy_setopt(curl,CURLOPT_POSTQUOTE,0);
- CURLcode err = curl_easy_perform(curl);
+ oslFileHandle res( NULL );
+ if ( osl_createTempFile( NULL, &res, NULL ) == osl_File_E_None )
+ {
+ curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,file_write);
+ curl_easy_setopt(curl,CURLOPT_WRITEDATA,res);
- if(err == CURLE_OK)
- rewind(res);
- else {
- fclose(res),res = 0;
- throw curl_exception(err);
+ curl_easy_setopt(curl,CURLOPT_POSTQUOTE,0);
+ CURLcode err = curl_easy_perform(curl);
+
+ if(err == CURLE_OK)
+ osl_setFilePos( res, osl_Pos_Absolut, 0 );
+ else {
+ osl_closeFile(res),res = 0;
+ throw curl_exception(err);
+ }
}
return res;