mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-12-22 08:48:55 +00:00
Merge pull request #975 from ggtakec/master
Fixed ref-count when error occurred.
This commit is contained in:
commit
895d5006bb
@ -814,11 +814,17 @@ int FdEntity::Open(headers_t* pmeta, ssize_t size, time_t time, bool no_fd_lock_
|
||||
// truncate temporary file size
|
||||
if(-1 == ftruncate(fd, static_cast<size_t>(size))){
|
||||
S3FS_PRN_ERR("failed to truncate temporary file(%d) by errno(%d).", fd, errno);
|
||||
if(0 < refcnt){
|
||||
refcnt--;
|
||||
}
|
||||
return -EIO;
|
||||
}
|
||||
// resize page list
|
||||
if(!pagelist.Resize(static_cast<size_t>(size), false)){
|
||||
S3FS_PRN_ERR("failed to truncate temporary file information(%d).", fd);
|
||||
if(0 < refcnt){
|
||||
refcnt--;
|
||||
}
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
@ -2148,6 +2154,9 @@ FdEntity* FdManager::Open(const char* path, headers_t* pmeta, ssize_t size, time
|
||||
|
||||
// open
|
||||
if(0 != ent->Open(pmeta, size, time, no_fd_lock_wait)){
|
||||
if(close){
|
||||
ent->Close();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
if(close){
|
||||
|
Loading…
Reference in New Issue
Block a user