[common] Fix coverity issue number 112263 16/174116/1
authorRafal Walczyna <r.walczyna@partner.samsung.com>
Wed, 28 Mar 2018 06:45:53 +0000 (08:45 +0200)
committerRafal Walczyna <r.walczyna@partner.samsung.com>
Wed, 28 Mar 2018 07:40:23 +0000 (09:40 +0200)
[Verification] Build successful

Change-Id: I858c6f6cf34174d1f3efadfbdb688fb0bc04ae8d
Signed-off-by: Rafal Walczyna <r.walczyna@partner.samsung.com>
src/common/filesystem/filesystem_storage.h
src/common/tools.cc

index 8ff7828..fd5dc17 100644 (file)
@@ -79,6 +79,7 @@ class Storage : public VirtualRoot {
   int id() const {
     return id_;
   }
+
  private:
   int id_;
 };
index 5ef95ca..fd4a2f3 100644 (file)
@@ -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");