fix pop3 message quarantining on linux, r=mkmelin, sr=neil, 454622
authorDavid Bienvenu <bienvenu@nventure.com>
Tue, 23 Sep 2008 15:58:16 -0700
changeset 411 2f10b93d7a68d8c5b53414014367af5a1ed3cc78
parent 410 7f9f210762cdb0055c912d9e3cd4b19e111b1d44
child 412 84a0c590dcc7ccb7a626f3e989c52f0121d16118
push idunknown
push userunknown
push dateunknown
reviewersmkmelin, neil, 454622
bugs454622
fix pop3 message quarantining on linux, r=mkmelin, sr=neil, 454622
mailnews/local/src/nsPop3Sink.cpp
--- a/mailnews/local/src/nsPop3Sink.cpp
+++ b/mailnews/local/src/nsPop3Sink.cpp
@@ -837,17 +837,22 @@ nsPop3Sink::IncorporateComplete(nsIMsgWi
 
           PRInt64 folderSize, tmpDownloadFileSize;
           m_folder->GetFilePath(getter_AddRefs(path));
           path->GetFileSize(&folderSize);
           PRUint32 newMsgPos = (PRUint32) folderSize;
           PRUint32 msgSize;
           hdr->GetMessageSize(&msgSize);
           hdr->SetMessageKey(newMsgPos);
-          m_tmpDownloadFile->GetFileSize(&tmpDownloadFileSize);
+          // we need to clone because nsLocalFileUnix caches its stat result,
+          // so it doesn't realize the file has changed size.
+          nsCOMPtr <nsIFile> tmpClone;
+          rv = m_tmpDownloadFile->Clone(getter_AddRefs(tmpClone));
+          NS_ENSURE_SUCCESS(rv, rv);
+          tmpClone->GetFileSize(&tmpDownloadFileSize);
 
           if (msgSize > tmpDownloadFileSize)
             rv = NS_MSG_ERROR_WRITING_MAIL_FOLDER;
           else
             rv = m_newMailParser->AppendMsgFromFile(inboxInputStream, 0, msgSize, path);
           if (NS_FAILED(rv))
             return HandleTempDownloadFailed(aMsgWindow);