mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
it happens sometimes that files of size 0 are transfered. In such a case the destination file is not written down, and the following calls to moveFile in ftcontroller.cc produce an error. Ive put an if to avoid this.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1117 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
9d89c12a38
commit
1ff00dcf07
@ -318,7 +318,10 @@ bool ftController::completeFile(std::string hash)
|
||||
|
||||
fc->mState = ftFileControl::COMPLETED;
|
||||
|
||||
if( moveFile(fc->mCurrentPath,fc->mDestination) )
|
||||
// I don't know how the size can be zero, but believe me, this happens,
|
||||
// and it causes an error on linux because then the file may not even exist.
|
||||
//
|
||||
if( fc->mSize > 0 && moveFile(fc->mCurrentPath,fc->mDestination) )
|
||||
fc->mCurrentPath = fc->mDestination;
|
||||
else
|
||||
fc->mState = ftFileControl::ERROR_COMPLETION;
|
||||
@ -338,6 +341,10 @@ bool ftController::completeFile(std::string hash)
|
||||
period = 30 * 24 * 3600; /* 30 days */
|
||||
flags = 0;
|
||||
|
||||
#ifdef CONTROL_DEBUG
|
||||
std::cerr << "CompleteFile(): size = " << size << std::endl ;
|
||||
#endif
|
||||
|
||||
doCallback = fc->mDoCallback;
|
||||
callbackCode = fc->mCallbackCode;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user