Fix SetPackageDirectoryOwnerAndPermissions 56/143056/4
authorSangyoon Jang <jeremy.jang@samsung.com>
Tue, 8 Aug 2017 09:05:44 +0000 (18:05 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Thu, 10 Aug 2017 03:01:45 +0000 (03:01 +0000)
Skip when path is symlink.

Change-Id: Id133bb82a196c276340bb9588f633988ca1aa95d
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/common/shared_dirs.cc

index 3aea6b7..32fea9d 100644 (file)
@@ -764,11 +764,13 @@ bool SetPackageDirectoryOwnerAndPermissions(const bf::path& path, uid_t uid) {
       perms644 | bf::owner_exe | bf::group_exe | bf::others_exe;
   for (bf::recursive_directory_iterator iter(path);
       iter != bf::recursive_directory_iterator(); ++iter) {
-    if (bf::is_directory(iter->path()) &&
+    if (bf::is_symlink(symlink_status(iter->path())) ||
+        (bf::is_directory(iter->path()) &&
         (iter->path().filename() == ".mmc" ||
             iter->path().filename() == ".pkg" ||
-            iter->path().filename() == "tep")) {
-      // skip path, which is related to mount or directory installer creates
+            iter->path().filename() == "tep"))) {
+      // skip symlink or path which is related to
+      // mount or directory installer creates
       continue;
     } else if (bf::is_directory(iter->path())) {
       // directories