mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-06-02 00:50:49 +00:00
Fixed segmentation fault caused by file write failure (#2123)
This commit is contained in:
parent
aeacd0a7d3
commit
9d00b8d4a8
|
@ -449,7 +449,7 @@ bool StatCache::UpdateMetaStats(const std::string& key, headers_t& meta)
|
||||||
SetStatCacheTime(ent->cache_date);
|
SetStatCacheTime(ent->cache_date);
|
||||||
|
|
||||||
// Update only mode
|
// Update only mode
|
||||||
ent->stbuf.st_mode = get_mode(meta);
|
ent->stbuf.st_mode = get_mode(meta, key);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ mode_t get_mode(const char *s, int base)
|
||||||
return static_cast<mode_t>(cvt_strtoofft(s, base));
|
return static_cast<mode_t>(cvt_strtoofft(s, base));
|
||||||
}
|
}
|
||||||
|
|
||||||
mode_t get_mode(const headers_t& meta, const char* path, bool checkdir, bool forcedir)
|
mode_t get_mode(const headers_t& meta, const std::string& strpath, bool checkdir, bool forcedir)
|
||||||
{
|
{
|
||||||
mode_t mode = 0;
|
mode_t mode = 0;
|
||||||
bool isS3sync = false;
|
bool isS3sync = false;
|
||||||
|
@ -141,7 +141,7 @@ mode_t get_mode(const headers_t& meta, const char* path, bool checkdir, bool for
|
||||||
}else{
|
}else{
|
||||||
// If another tool creates an object without permissions, default to owner
|
// If another tool creates an object without permissions, default to owner
|
||||||
// read-write and group readable.
|
// read-write and group readable.
|
||||||
mode = path[strlen(path) - 1] == '/' ? 0750 : 0640;
|
mode = (!strpath.empty() && '/' == *strpath.rbegin()) ? 0750 : 0640;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checking the bitmask, if the last 3 bits are all zero then process as a regular
|
// Checking the bitmask, if the last 3 bits are all zero then process as a regular
|
||||||
|
@ -163,7 +163,7 @@ mode_t get_mode(const headers_t& meta, const char* path, bool checkdir, bool for
|
||||||
if(strConType == "application/x-directory" || strConType == "httpd/unix-directory"){
|
if(strConType == "application/x-directory" || strConType == "httpd/unix-directory"){
|
||||||
// Nextcloud uses this MIME type for directory objects when mounting bucket as external Storage
|
// Nextcloud uses this MIME type for directory objects when mounting bucket as external Storage
|
||||||
mode |= S_IFDIR;
|
mode |= S_IFDIR;
|
||||||
}else if(path && 0 < strlen(path) && '/' == path[strlen(path) - 1]){
|
}else if(!strpath.empty() && '/' == *strpath.rbegin()){
|
||||||
if(strConType == "binary/octet-stream" || strConType == "application/octet-stream"){
|
if(strConType == "binary/octet-stream" || strConType == "application/octet-stream"){
|
||||||
mode |= S_IFDIR;
|
mode |= S_IFDIR;
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -46,7 +46,7 @@ struct timespec get_atime(const headers_t& meta, bool overcheck = true);
|
||||||
off_t get_size(const char *s);
|
off_t get_size(const char *s);
|
||||||
off_t get_size(const headers_t& meta);
|
off_t get_size(const headers_t& meta);
|
||||||
mode_t get_mode(const char *s, int base = 0);
|
mode_t get_mode(const char *s, int base = 0);
|
||||||
mode_t get_mode(const headers_t& meta, const char* path = NULL, bool checkdir = false, bool forcedir = false);
|
mode_t get_mode(const headers_t& meta, const std::string& strpath, bool checkdir = false, bool forcedir = false);
|
||||||
uid_t get_uid(const char *s);
|
uid_t get_uid(const char *s);
|
||||||
uid_t get_uid(const headers_t& meta);
|
uid_t get_uid(const headers_t& meta);
|
||||||
gid_t get_gid(const char *s);
|
gid_t get_gid(const char *s);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user