mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05:00
fixed re-copy of dht bootstrap file when the file is empty
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5385 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8f27ab280f
commit
570369ad9c
@ -2013,7 +2013,7 @@ int RsServer::StartupRetroShare()
|
|||||||
* if not... copy from dataDirectory
|
* if not... copy from dataDirectory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!RsDirUtil::checkFile(bootstrapfile))
|
if (!RsDirUtil::checkFile(bootstrapfile,true))
|
||||||
{
|
{
|
||||||
std::cerr << "DHT bootstrap file not in ConfigDir: " << bootstrapfile << std::endl;
|
std::cerr << "DHT bootstrap file not in ConfigDir: " << bootstrapfile << std::endl;
|
||||||
std::string installfile = RsInit::getRetroshareDataDirectory();
|
std::string installfile = RsInit::getRetroshareDataDirectory();
|
||||||
|
@ -351,7 +351,7 @@ bool RsDirUtil::copyFile(const std::string& source,const std::string& dest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool RsDirUtil::checkFile(const std::string& filename)
|
bool RsDirUtil::checkFile(const std::string& filename,bool disallow_empty_file)
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
mode_t st_mode;
|
mode_t st_mode;
|
||||||
@ -362,8 +362,8 @@ bool RsDirUtil::checkFile(const std::string& filename)
|
|||||||
val = _wstat(wfilename.c_str(), &buf);
|
val = _wstat(wfilename.c_str(), &buf);
|
||||||
st_mode = buf.st_mode;
|
st_mode = buf.st_mode;
|
||||||
#else
|
#else
|
||||||
struct stat buf;
|
struct stat64 buf;
|
||||||
val = stat(filename.c_str(), &buf);
|
val = stat64(filename.c_str(), &buf);
|
||||||
st_mode = buf.st_mode;
|
st_mode = buf.st_mode;
|
||||||
#endif
|
#endif
|
||||||
if (val == -1)
|
if (val == -1)
|
||||||
@ -383,6 +383,10 @@ bool RsDirUtil::checkFile(const std::string& filename)
|
|||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(disallow_empty_file && buf.st_size == 0)
|
||||||
|
return false ;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ bool crc32File(FILE *f,uint64_t file_size,uint32_t chunk_size,CRC32Map& map) ;
|
|||||||
int breakupDirList(const std::string& path, std::list<std::string> &subdirs);
|
int breakupDirList(const std::string& path, std::list<std::string> &subdirs);
|
||||||
|
|
||||||
bool copyFile(const std::string& source,const std::string& dest);
|
bool copyFile(const std::string& source,const std::string& dest);
|
||||||
bool checkFile(const std::string& filename);
|
bool checkFile(const std::string& filename,bool disallow_empty_file = false);
|
||||||
bool checkDirectory(const std::string& dir);
|
bool checkDirectory(const std::string& dir);
|
||||||
bool checkCreateDirectory(const std::string& dir);
|
bool checkCreateDirectory(const std::string& dir);
|
||||||
bool cleanupDirectory(const std::string& dir, const std::list<std::string> &keepFiles);
|
bool cleanupDirectory(const std::string& dir, const std::list<std::string> &keepFiles);
|
||||||
|
Loading…
Reference in New Issue
Block a user