mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-21 07:20:28 -04: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
3 changed files with 9 additions and 5 deletions
|
@ -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;
|
||||
mode_t st_mode;
|
||||
|
@ -362,8 +362,8 @@ bool RsDirUtil::checkFile(const std::string& filename)
|
|||
val = _wstat(wfilename.c_str(), &buf);
|
||||
st_mode = buf.st_mode;
|
||||
#else
|
||||
struct stat buf;
|
||||
val = stat(filename.c_str(), &buf);
|
||||
struct stat64 buf;
|
||||
val = stat64(filename.c_str(), &buf);
|
||||
st_mode = buf.st_mode;
|
||||
#endif
|
||||
if (val == -1)
|
||||
|
@ -383,6 +383,10 @@ bool RsDirUtil::checkFile(const std::string& filename)
|
|||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
if(disallow_empty_file && buf.st_size == 0)
|
||||
return false ;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue