Fix static analysis issue 79/305179/2
authorIlho Kim <ilho159.kim@samsung.com>
Mon, 29 Jan 2024 12:00:20 +0000 (21:00 +0900)
committerIlho Kim <ilho159.kim@samsung.com>
Mon, 29 Jan 2024 12:06:49 +0000 (21:06 +0900)
Use of auto that causes a copy

Change-Id: Id308b78bc42bba876c4f83d85f407ed4e4a0ce1a
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
src/common/step/filesystem/step_change_ownership_and_permission.cc

index 48be8b6..7b8013c 100644 (file)
@@ -95,7 +95,7 @@ bool GrantDefaultPermissions(bf::path pkg_path, bool skip_symlink) {
   }
   for (auto& entry :
       boost::make_iterator_range(bf::directory_iterator(pkg_path), {})) {
-    auto path = entry.path();
+    const auto& path = entry.path();
 
     if (skip_symlink && bf::is_symlink(symlink_status(path)))
           continue;
@@ -111,7 +111,7 @@ bool GrantDefaultPermissions(bf::path pkg_path, bool skip_symlink) {
         return false;
       for (auto& bin_entry :
           boost::make_iterator_range(bf::directory_iterator(path), {})) {
-        auto bin_path = bin_entry.path();
+        const auto& bin_path = bin_entry.path();
         if (bf::is_symlink(symlink_status(bin_path)))
           continue;
 
@@ -128,7 +128,7 @@ bool GrantDefaultPermissions(bf::path pkg_path, bool skip_symlink) {
         return false;
       for (auto& lib_entry :
           boost::make_iterator_range(bf::directory_iterator(path), {})) {
-        auto lib_path = lib_entry.path();
+        const auto& lib_path = lib_entry.path();
         if (bf::is_symlink(symlink_status(lib_path)))
           continue;