summaryrefslogtreecommitdiff
path: root/indra/viewer_components
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-04-23 14:49:32 -0400
committerNat Goodspeed <nat@lindenlab.com>2012-04-23 14:49:32 -0400
commit7079513c23f4bbef81d57d9615dd1e45ebfbe5b9 (patch)
tree2d2e75da06b3558d4b233bb9fbf3a8a8845b08cd /indra/viewer_components
parent78816bb1561190ac5a882caa90da2865d4aaa353 (diff)
IQA-463: Add apr_file_open(APR_CREATE) flag for downloaded installer.
This handles the case when the target file doesn't exist, just as APR_TRUNCATE handles the case when it does. Strengthen error checks concerning downloaded installer file from ll_apr_warn_status() to ll_apr_assert_status(). Failing to recognize (e.g.) failure to open that file only leads to mysterious crashes down the road; this removes the mystery.
Diffstat (limited to 'indra/viewer_components')
-rw-r--r--indra/viewer_components/updater/llupdatedownloader.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp
index 5d48c35b4c..abe45cc52b 100644
--- a/indra/viewer_components/updater/llupdatedownloader.cpp
+++ b/indra/viewer_components/updater/llupdatedownloader.cpp
@@ -347,7 +347,7 @@ size_t LLUpdateDownloader::Implementation::onBody(void * buffer, size_t size)
if((size == 0) || (buffer == 0)) return 0;
apr_size_t written(size);
- ll_apr_warn_status(apr_file_write(mDownloadStream, buffer, &written));
+ ll_apr_assert_status(apr_file_write(mDownloadStream, buffer, &written));
return written;
}
@@ -379,7 +379,7 @@ int LLUpdateDownloader::Implementation::onProgress(double downloadSize, double b
void LLUpdateDownloader::Implementation::run(void)
{
CURLcode code = curl_easy_perform(mCurl);
- ll_apr_warn_status(apr_file_close(mDownloadStream));
+ ll_apr_assert_status(apr_file_close(mDownloadStream));
mDownloadStream = NULL;
if(code == CURLE_OK) {
LLFile::remove(mDownloadRecordPath);
@@ -459,9 +459,9 @@ void LLUpdateDownloader::Implementation::resumeDownloading(size_t startByte)
if(mHeaderList == 0) throw DownloadError("cannot add Range header");
throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_HTTPHEADER, mHeaderList));
- ll_apr_warn_status(apr_file_open(&mDownloadStream, mDownloadData["path"].asString().c_str(),
- APR_WRITE | APR_APPEND | APR_BINARY | APR_BUFFERED,
- APR_OS_DEFAULT, gAPRPoolp));
+ ll_apr_assert_status(apr_file_open(&mDownloadStream, mDownloadData["path"].asString().c_str(),
+ APR_WRITE | APR_APPEND | APR_BINARY | APR_BUFFERED,
+ APR_OS_DEFAULT, gAPRPoolp));
start();
}
@@ -484,9 +484,9 @@ void LLUpdateDownloader::Implementation::startDownloading(LLURI const & uri, std
llofstream dataStream(mDownloadRecordPath);
LLSDSerialize::toPrettyXML(mDownloadData, dataStream);
- ll_apr_warn_status(apr_file_open(&mDownloadStream, filePath.c_str(),
- APR_WRITE | APR_TRUNCATE | APR_BINARY | APR_BUFFERED,
- APR_OS_DEFAULT, gAPRPoolp));
+ ll_apr_assert_status(apr_file_open(&mDownloadStream, filePath.c_str(),
+ APR_WRITE | APR_CREATE | APR_TRUNCATE | APR_BINARY | APR_BUFFERED,
+ APR_OS_DEFAULT, gAPRPoolp));
// IQA-463: Do NOT let this open file be inherited by child processes.
// That's why we switched from llofstream to apr_file_t. From
// apr_file_open() doc