Fixing race condition in FdEntity::GetStats

This commit is contained in:
Paul Wulff 2017-12-13 10:49:00 +01:00
parent 566961c7a5
commit cea7d44717

View File

@ -1001,10 +1001,10 @@ bool FdEntity::OpenAndLoadAll(headers_t* pmeta, size_t* size, bool force_load)
bool FdEntity::GetStats(struct stat& st) bool FdEntity::GetStats(struct stat& st)
{ {
AutoLock auto_lock(&fdent_lock);
if(-1 == fd){ if(-1 == fd){
return false; return false;
} }
AutoLock auto_lock(&fdent_lock);
memset(&st, 0, sizeof(struct stat)); memset(&st, 0, sizeof(struct stat));
if(-1 == fstat(fd, &st)){ if(-1 == fstat(fd, &st)){