From f1f45c9b0b7fffcbd9277f035300d8a8ec8371e6 Mon Sep 17 00:00:00 2001 From: lotodore Date: Sun, 11 Nov 2007 15:59:41 +0000 Subject: [PATCH] Truncate any existing avatar file when saving in cache dir. --- src/core/common/avatarmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/common/avatarmanager.cpp b/src/core/common/avatarmanager.cpp index 327bb249..a304f331 100644 --- a/src/core/common/avatarmanager.cpp +++ b/src/core/common/avatarmanager.cpp @@ -359,7 +359,7 @@ AvatarManager::StoreAvatarInCache(const MD5Buf &md5buf, AvatarFileType avatarFil path tmpPath(cacheDir); tmpPath /= (md5buf.ToString() + ext); string fileName(tmpPath.file_string()); - ofstream o(fileName.c_str(), ios_base::out | ios_base::binary); + ofstream o(fileName.c_str(), ios_base::out | ios_base::binary | ios_base::trunc); if (!o.fail()) { o.write((const char *)data, size);