diff --git a/libretroshare/src/dbase/fimonitor.cc b/libretroshare/src/dbase/fimonitor.cc index a20d35e68..8ba3a4cb0 100644 --- a/libretroshare/src/dbase/fimonitor.cc +++ b/libretroshare/src/dbase/fimonitor.cc @@ -679,25 +679,28 @@ void FileIndexMonitor::locked_saveFileIndexes() fi.saveIndex(fname_total, calchash, sizetmp,std::set()); // save all files fi.saveIndex(fname_browsable, calchash, size,forbidden_dirs); // save only browsable files + if(size > 0) + { #ifdef FIM_DEBUG - std::cerr << "FileIndexMonitor::updateCycle() saved with hash:" << calchash; - std::cerr << std::endl; + std::cerr << "FileIndexMonitor::updateCycle() saved with hash:" << calchash; + std::cerr << std::endl; #endif - /* should clean up the previous cache.... */ + /* should clean up the previous cache.... */ - /* flag as new info */ - CacheData data; - data.pid = fi.root->id; - data.cid.type = getCacheType(); - data.cid.subid = 0; - data.path = path; - data.name = tmpname_browsable; - data.hash = calchash; - data.size = size; - data.recvd = time(NULL); + /* flag as new info */ + CacheData data; + data.pid = fi.root->id; + data.cid.type = getCacheType(); + data.cid.subid = 0; + data.path = path; + data.name = tmpname_browsable; + data.hash = calchash; + data.size = size; + data.recvd = time(NULL); - updateCache(data); + updateCache(data); + } #ifdef FIM_DEBUG std::cerr << "FileIndexMonitor::updateCycle() called updateCache()"; diff --git a/libretroshare/src/dbase/findex.cc b/libretroshare/src/dbase/findex.cc index f8ed0a6a2..fd82941d8 100644 --- a/libretroshare/src/dbase/findex.cc +++ b/libretroshare/src/dbase/findex.cc @@ -923,6 +923,9 @@ int FileIndex::saveIndex(std::string filename, std::string &fileHash, uint64_t & std::ofstream file (filenametmp.c_str(), std::ofstream::binary); std::ostringstream oss; + size = 0 ; + fileHash = "" ; + if (!file) { #ifdef FI_DEBUG