mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-01 10:05:10 -05:00
added security to fd management, corrected bug causing bad fseeks
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5.0@2651 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
dc8978b401
commit
9abbe935b3
@ -431,6 +431,7 @@ bool ftExtraList::loadList(std::list<RsItem *> load)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
|
fd = NULL ;
|
||||||
|
|
||||||
if (ts > (time_t)fi->file.age)
|
if (ts > (time_t)fi->file.age)
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,7 @@ ftFileProvider::~ftFileProvider(){
|
|||||||
#endif
|
#endif
|
||||||
if (fd!=NULL) {
|
if (fd!=NULL) {
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
|
fd = NULL ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +240,7 @@ int ftFileProvider::initializeFileAttrs()
|
|||||||
* attempt to open file
|
* attempt to open file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fd = fopen64(file_name.c_str(), "rb");
|
fd = fopen64(file_name.c_str(), "r+b");
|
||||||
if (!fd)
|
if (!fd)
|
||||||
{
|
{
|
||||||
std::cerr << "ftFileProvider::initializeFileAttrs() Failed to open (r+b): ";
|
std::cerr << "ftFileProvider::initializeFileAttrs() Failed to open (r+b): ";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user