1) If a downloaded file already existed (e.g. an aborted download previously),
   the rename from *.part might fail (the behaviour of rename in this case
   is unspecified).
2) Reset the abort flag if a download is aborted - otherwise no further download
   is possible.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8585 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2011-05-15 12:56:07 +00:00
parent 3198d8a6b7
commit c3a0007bd5

View File

@ -380,7 +380,9 @@ bool NetworkHttp::downloadFileInternal(Request *request)
{
if(UserConfigParams::logAddons())
printf("[addons] Download successful.\n");
// The behaviour of rename is unspecified if the target
// file should already exist - so remove it.
file_manager->removeFile(full_save);
int ret = rename((full_save+".part").c_str(), full_save.c_str());
// In case of an error, set the status to indicate this
if(ret!=0)
@ -484,6 +486,8 @@ int NetworkHttp::progressDownload(void *clientp,
{
if(UserConfigParams::logAddons())
printf("[addons] Aborting download in progress.\n");
// Reset abort flag so that the next download will work as expected.
network_http->m_abort.set(false);
return 1;
}
float f;