mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-12-22 08:48:55 +00:00
Fix issues discovered by Coverity (#2535)
This commit is contained in:
parent
4605cc2035
commit
743c86e506
@ -1858,7 +1858,9 @@ bool S3fsCurl::AddUserAgent(const CurlUniquePtr& hCurl)
|
||||
return false;
|
||||
}
|
||||
if(S3fsCurl::IsUserAgentFlag()){
|
||||
curl_easy_setopt(hCurl, CURLOPT_USERAGENT, S3fsCurl::userAgent.c_str());
|
||||
if(CURLE_OK != curl_easy_setopt(hCurl, CURLOPT_USERAGENT, S3fsCurl::userAgent.c_str())){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ bool S3fsMultiCurl::SetS3fsCurlObject(std::unique_ptr<S3fsCurl> s3fscurl)
|
||||
int S3fsMultiCurl::MultiPerform()
|
||||
{
|
||||
std::map<std::thread::id, std::pair<std::thread, std::future<int>>> threads;
|
||||
bool success = true;
|
||||
int result = 0;
|
||||
bool isMultiHead = false;
|
||||
Semaphore sem(GetMaxParallelism());
|
||||
|
||||
@ -164,12 +164,13 @@ int S3fsMultiCurl::MultiPerform()
|
||||
long int int_retval = it->second.second.get();
|
||||
if (int_retval && !(int_retval == -ENOENT && isMultiHead)) {
|
||||
S3FS_PRN_WARN("thread terminated with non-zero return code: %ld", int_retval);
|
||||
result = int_retval;
|
||||
}
|
||||
threads.erase(it);
|
||||
}
|
||||
completed_tids.clear();
|
||||
|
||||
return success ? 0 : -EIO;
|
||||
return result;
|
||||
}
|
||||
|
||||
int S3fsMultiCurl::MultiRead()
|
||||
|
@ -1203,13 +1203,13 @@ int FdEntity::NoCacheLoadAndPost(PseudoFdInfo* pseudo_obj, off_t start, off_t si
|
||||
fdpage page(iter->offset, start - iter->offset, iter->loaded, false);
|
||||
iter->bytes -= (start - iter->offset);
|
||||
iter->offset = start;
|
||||
pagelist.pages.insert(iter, page);
|
||||
iter = pagelist.pages.insert(iter, page);
|
||||
}
|
||||
if(0 != size && start + size < iter->next()){
|
||||
fdpage page(iter->offset, start + size - iter->offset, true, false);
|
||||
iter->bytes -= (start + size - iter->offset);
|
||||
iter->offset = start + size;
|
||||
pagelist.pages.insert(iter, page);
|
||||
iter = pagelist.pages.insert(iter, page);
|
||||
}else{
|
||||
iter->loaded = true;
|
||||
iter->modified = false;
|
||||
|
@ -73,6 +73,9 @@ static std::unique_ptr<unsigned char[]> create_random_data(off_t size)
|
||||
readcnt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
||||
return pbuff;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user