From f7760976a57714823a2672f70c0b2e54f14f651d Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Tue, 12 Feb 2019 18:37:24 -0800 Subject: [PATCH 1/2] Document lack of inotify support References #45. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b6f6707..5303b5d 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,7 @@ Generally S3 cannot offer the same performance or semantics as a local file syst * no atomic renames of files or directories * no coordination between multiple clients mounting the same bucket * no hard links +* inotify detects only local modifications, not external ones by other clients or tools References ---------- From eeb839242ba826707205b0b776c042203226d01b Mon Sep 17 00:00:00 2001 From: Takeshi Nakatani Date: Sun, 17 Feb 2019 13:59:11 +0000 Subject: [PATCH 2/2] Fixed code for latest cppcheck error on OSX --- Makefile.am | 2 ++ src/curl.cpp | 5 ++--- src/gnutls_auth.cpp | 1 + src/s3fs.cpp | 6 +++--- src/s3fs_util.cpp | 2 ++ src/string_util.cpp | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index a31513b..bf2bf14 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,6 +32,7 @@ cppcheck: cppcheck --quiet --error-exitcode=1 \ --inline-suppr \ --std=c++03 \ + --xml \ -D HAVE_ATTR_XATTR_H \ -D HAVE_SYS_EXTATTR_H \ -D HAVE_MALLOC_TRIM \ @@ -40,4 +41,5 @@ cppcheck: -U ENOATTR \ --enable=warning,style,information,missingInclude \ --suppress=missingIncludeSystem \ + --suppress=unmatchedSuppression \ src/ test/ diff --git a/src/curl.cpp b/src/curl.cpp index 471fb92..20d55dc 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -659,9 +659,8 @@ string S3fsCurl::LookupMimeType(const string& name) return result; } // extract the last extension - if(last_pos != string::npos){ - ext = name.substr(1+last_pos, string::npos); - } + ext = name.substr(1+last_pos, string::npos); + if (last_pos != string::npos) { // one dot was found, now look for another if (first_pos != string::npos && first_pos < last_pos) { diff --git a/src/gnutls_auth.cpp b/src/gnutls_auth.cpp index a4b4342..0a1d16c 100644 --- a/src/gnutls_auth.cpp +++ b/src/gnutls_auth.cpp @@ -371,6 +371,7 @@ unsigned char* s3fs_sha256hexsum(int fd, off_t start, ssize_t size) bool s3fs_sha256(const unsigned char* data, unsigned int datalen, unsigned char** digest, unsigned int* digestlen) { (*digestlen) = static_cast(get_sha256_digest_length()); + // cppcheck-suppress constArgument if(NULL == ((*digest) = reinterpret_cast(malloc(*digestlen)))){ return false; } diff --git a/src/s3fs.cpp b/src/s3fs.cpp index e24f9fc..8b6ce97 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -883,7 +883,7 @@ static int s3fs_getattr(const char* path, struct stat* stbuf) static int s3fs_readlink(const char* path, char* buf, size_t size) { - if(!path || !buf || 0 >= size){ + if(!path || !buf || 0 == size){ return 0; } // Open @@ -2161,7 +2161,7 @@ static int s3fs_read(const char* path, char* buf, size_t size, off_t offset, str // check real file size size_t realsize = 0; - if(!ent->GetSize(realsize) || realsize <= 0){ + if(!ent->GetSize(realsize) || 0 == realsize){ S3FS_PRN_DBG("file size is 0, so break to read."); FdManager::get()->Close(ent); return 0; @@ -3255,7 +3255,7 @@ static int s3fs_listxattr(const char* path, char* list, size_t size) } // check parameters - if(size <= 0){ + if(0 == size){ free_xattrs(xattrs); return total; } diff --git a/src/s3fs_util.cpp b/src/s3fs_util.cpp index d1365d5..b8692f5 100644 --- a/src/s3fs_util.cpp +++ b/src/s3fs_util.cpp @@ -152,7 +152,9 @@ bool S3ObjList::insert_normalized(const char* name, const char* normalized, bool // found name --> over write (*iter).second.orgname.erase(); (*iter).second.etag.erase(); + // cppcheck-suppress unreadVariable (*iter).second.normalname = normalized; + // cppcheck-suppress unreadVariable (*iter).second.is_dir = is_dir; }else{ // not found --> add new object diff --git a/src/string_util.cpp b/src/string_util.cpp index 9522b1e..7e9f23a 100644 --- a/src/string_util.cpp +++ b/src/string_util.cpp @@ -369,7 +369,7 @@ char* s3fs_base64(const unsigned char* input, size_t length) static const char* base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; char* result; - if(!input || 0 >= length){ + if(!input || 0 == length){ return NULL; } if(NULL == (result = reinterpret_cast(malloc((((length / 3) + 1) * 4 + 1) * sizeof(char))))){