mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-11-18 02:05:13 +00:00
Merge pull request #219 from andrewgaul/coverity
Address Coverity errors
This commit is contained in:
commit
49e32967ec
@ -2328,6 +2328,9 @@ int S3fsCurl::PutRequest(const char* tpath, headers_t& meta, int fd)
|
||||
// duplicate fd
|
||||
if(-1 == (fd2 = dup(fd)) || -1 == fstat(fd2, &st) || 0 != lseek(fd2, 0, SEEK_SET) || NULL == (file = fdopen(fd2, "rb"))){
|
||||
DPRN("Could not duplicate file discriptor(errno=%d)", errno);
|
||||
if(-1 != fd2){
|
||||
close(fd2);
|
||||
}
|
||||
return -errno;
|
||||
}
|
||||
b_infile = file;
|
||||
|
@ -491,7 +491,7 @@ void PageList::Dump(void)
|
||||
// FdEntity methods
|
||||
//------------------------------------------------
|
||||
FdEntity::FdEntity(const char* tpath, const char* cpath)
|
||||
: is_lock_init(false), path(SAFESTRPTR(tpath)), cachepath(SAFESTRPTR(cpath)), fd(-1), file(NULL), is_modify(false)
|
||||
: is_lock_init(false), refcnt(0), path(SAFESTRPTR(tpath)), cachepath(SAFESTRPTR(cpath)), fd(-1), file(NULL), is_modify(false)
|
||||
{
|
||||
try{
|
||||
pthread_mutex_init(&fdent_lock, NULL);
|
||||
|
@ -217,13 +217,13 @@ static int s3fs_removexattr(const char* path, const char* name);
|
||||
//-------------------------------------------------------------------
|
||||
static bool is_special_name_folder_object(const char* path)
|
||||
{
|
||||
string strpath = path;
|
||||
headers_t header;
|
||||
|
||||
if(!path || '\0' == path[0]){
|
||||
return false;
|
||||
}
|
||||
|
||||
string strpath = path;
|
||||
headers_t header;
|
||||
|
||||
strpath = path;
|
||||
if(string::npos == strpath.find("_$folder$", 0)){
|
||||
if('/' == strpath[strpath.length() - 1]){
|
||||
@ -704,7 +704,7 @@ static int put_headers(const char* path, headers_t& meta, bool is_copy)
|
||||
// files larger than 5GB must be modified via the multipart interface
|
||||
// *** If there is not target object(a case of move command),
|
||||
// get_object_attribute() returns error with initilizing buf.
|
||||
get_object_attribute(path, &buf);
|
||||
(void)get_object_attribute(path, &buf);
|
||||
|
||||
if(buf.st_size >= FIVE_GB){
|
||||
// multipart
|
||||
|
@ -589,7 +589,10 @@ int mkdirp(const string& path, mode_t mode)
|
||||
stringstream ss(path);
|
||||
while (getline(ss, component, '/')) {
|
||||
base += "/" + component;
|
||||
mkdir(base.c_str(), mode);
|
||||
int result = mkdir(base.c_str(), mode);
|
||||
if(0 != result){
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user