From 9808124852bbd71de634ab86abe890d85ebb4efa Mon Sep 17 00:00:00 2001 From: Rafal Walczyna Date: Wed, 28 Mar 2018 08:45:53 +0200 Subject: [PATCH] [common] Fix coverity issue number 112263 [Verification] Build successful Change-Id: I858c6f6cf34174d1f3efadfbdb688fb0bc04ae8d Signed-off-by: Rafal Walczyna --- src/common/filesystem/filesystem_storage.h | 1 + src/common/tools.cc | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/common/filesystem/filesystem_storage.h b/src/common/filesystem/filesystem_storage.h index 8ff78282..fd5dc178 100644 --- a/src/common/filesystem/filesystem_storage.h +++ b/src/common/filesystem/filesystem_storage.h @@ -79,6 +79,7 @@ class Storage : public VirtualRoot { int id() const { return id_; } + private: int id_; }; diff --git a/src/common/tools.cc b/src/common/tools.cc index 5ef95ca1..fd4a2f30 100644 --- a/src/common/tools.cc +++ b/src/common/tools.cc @@ -515,8 +515,7 @@ PlatformResult CheckStorageAccess(const std::string& path) { SCOPE_EXIT { free(real_path); }; - if ((nullptr == real_path && EACCES == errno) || - (-1 == stat(real_path, &buf) && EACCES == errno)) { + if ((nullptr == real_path || -1 == stat(real_path, &buf)) && (EACCES == errno)) { LoggerE("The application does not have necessary privilege to access given file: [%s]", path.c_str()); return PlatformResult(ErrorCode::SECURITY_ERR, @@ -532,8 +531,7 @@ TizenResult CheckStorageAccessAndReturn(const std::string& path) { SCOPE_EXIT { free(real_path); }; - if ((nullptr == real_path && EACCES == errno) || - (-1 == stat(real_path, &buf) && EACCES == errno)) { + if ((nullptr == real_path || -1 == stat(real_path, &buf)) && (EACCES == errno)) { LoggerE("The application does not have necessary privilege to access given file: [%s]", path.c_str()); return SecurityError("Permission denied: accessing files requires proper storage privilege"); -- 2.34.1