diff --git a/urbackupclient/client.cpp b/urbackupclient/client.cpp index ad94f8e9..63734f65 100644 --- a/urbackupclient/client.cpp +++ b/urbackupclient/client.cpp @@ -952,6 +952,9 @@ std::vector IndexThread::getFilesProxy(const std::wstring &orig_path, con if(use_db) { + std::vector db_files; + bool has_files=cd->getFiles(path_lower, db_files); + std::vector changed_files=cd->getChangedFiles((*it_dir).id); std::sort(changed_files.begin(), changed_files.end()); @@ -961,15 +964,21 @@ std::vector IndexThread::getFilesProxy(const std::wstring &orig_path, con { if(!tmp[i].isdir) { - if( std::binary_search(changed_files.begin(), changed_files.end(), tmp[i].name ) ) + std::vector::const_iterator it_db_file=std::lower_bound(db_files.begin(), db_files.end(), tmp[i]); + if( std::binary_search(changed_files.begin(), changed_files.end(), tmp[i].name ) || + ( it_db_file!=db_files.end() && (*it_db_file).name==tmp[i].name && (*it_db_file).last_modified<0 ) ) { tmp[i].last_modified*=Server->getRandomNumber(); + if(tmp[i].last_modified>0) + tmp[i].last_modified*=-1; + else if(tmp[i].last_modified==0) + tmp[i].last_modified=-1; } } } } - if(cd->hasFiles(path_lower) ) + if( has_files) { ++index_c_db_update; modifyFilesInt(path_lower, tmp); diff --git a/urbackupcommon/os_functions_lin.cpp b/urbackupcommon/os_functions_lin.cpp index 1a4f595f..233c0a5d 100644 --- a/urbackupcommon/os_functions_lin.cpp +++ b/urbackupcommon/os_functions_lin.cpp @@ -102,6 +102,7 @@ std::vector getFiles(const std::wstring &path, bool *has_error) continue; } f.last_modified=f_info.st_mtime; + if(f.last_modified<0) f.last_modified*=-1; f.size=f_info.st_size; } #ifndef sun @@ -109,6 +110,7 @@ std::vector getFiles(const std::wstring &path, bool *has_error) else { f.last_modified=f_info.st_mtime; + if(f.last_modified<0) f.last_modified*=-1; f.size=f_info.st_size; } #endif diff --git a/urbackupcommon/os_functions_win.cpp b/urbackupcommon/os_functions_win.cpp index 4876f4b1..1fc8e2b2 100644 --- a/urbackupcommon/os_functions_win.cpp +++ b/urbackupcommon/os_functions_win.cpp @@ -101,6 +101,8 @@ std::vector getFiles(const std::wstring &path, bool *has_error) size.HighPart=wfd.nFileSizeHigh; size.LowPart=wfd.nFileSizeLow; f.size=size.QuadPart; + + if(f.last_modified<0) f.last_modified*=-1; tmp.push_back(f); } }