mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-11 17:04:31 -05:00
added verification for file size computation (bug correction)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5.0@3068 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2da2e29fdb
commit
0095976d21
@ -724,12 +724,22 @@ bool p3Config::backedUpFileSave(const std::string& cfg_fname, const std::string&
|
||||
cfg_file = fopen(cfg_fname.c_str(), "wb");
|
||||
|
||||
if(cfg_file == NULL)
|
||||
{
|
||||
std::cerr << "p3Config::backedUpFileSave() fopen failed for file:" << cfg_fname << std::endl;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
//determine file size
|
||||
fseek(cfg_file, 0L, SEEK_END);
|
||||
size_file = ftell(cfg_file);
|
||||
|
||||
if(size_file < 0) // ftell returns -1 when fails
|
||||
{
|
||||
fclose(cfg_file);
|
||||
size_file = 0 ;
|
||||
}
|
||||
|
||||
fseek(cfg_file, 0L, SEEK_SET);
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
|
Loading…
Reference in New Issue
Block a user