mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-24 05:44:10 +00:00
Bug 368317 - temp files remain if MoveToNative fails in nsSafeFileOutputStream::Finish(). patch by Ryan Jones (sciguyryan@gmail.com), r=mvl, sr=biesi
This commit is contained in:
parent
98e31d90cd
commit
7ec8f6a8da
@ -552,12 +552,16 @@ nsSafeFileOutputStream::Finish()
|
||||
if (NS_FAILED(mTargetFile->Equals(mTempFile, &equal)) || !equal)
|
||||
NS_ERROR("mTempFile not equal to mTargetFile");
|
||||
#endif
|
||||
} else {
|
||||
nsCAutoString targetFilename;
|
||||
rv = mTargetFile->GetNativeLeafName(targetFilename);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = mTempFile->MoveToNative(nsnull, targetFilename); // This will replace target
|
||||
}
|
||||
else {
|
||||
nsCAutoString targetFilename;
|
||||
rv = mTargetFile->GetNativeLeafName(targetFilename);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// This will replace target.
|
||||
rv = mTempFile->MoveToNative(nsnull, targetFilename);
|
||||
if (NS_FAILED(rv))
|
||||
mTempFile->Remove(PR_FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user