diff --git a/src/Synchronizer.cpp b/src/Synchronizer.cpp index cbe402956..ce1d3a3e2 100644 --- a/src/Synchronizer.cpp +++ b/src/Synchronizer.cpp @@ -340,7 +340,7 @@ void Synchronizer::synchronizeDelete(const string &sourceFile, list::ite ScopedWriteLock s(ioc, sourceFile); cs->deleteObject(*it); - // delete any pending jobs for *it. + // delete any pending jobs for *it. There shouldn't be any, this is out of pure paranoia. boost::unique_lock sc(mutex); pendingOps.erase(*it); } @@ -414,17 +414,17 @@ void Synchronizer::synchronizeWithJournal(const string &sourceFile, list } throw runtime_error(string("Synchronizer: getObject() failed: ") + strerror_r(errno, buf, 80)); } - assert(size <= mdEntry.length); + //TODO!! This sucks. Need a way to pass in a larger array to cloud storage, and also have it not // do any add'l alloc'ing or copying if (size < mdEntry.length) { boost::shared_array tmp(new uint8_t[mdEntry.length]()); memcpy(tmp.get(), data.get(), size); - memset(&tmp[size], 0, mdEntry.length - size); // prob not necessary outside of testing + memset(&tmp[size], 0, mdEntry.length - size); data.swap(tmp); - size = mdEntry.length; } + size = mdEntry.length; // reset length. Using the metadata as a source of truth (truncation), not actual file length. err = ioc->mergeJournalInMem(data, size, journalName.c_str()); if (err)