Skip chmod operation about symbolic link when copy the file attribute. 31/214331/3 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20191031.005301 accepted/tizen/5.5/unified/mobile/hotfix/20201027.062211 accepted/tizen/5.5/unified/wearable/hotfix/20201027.102512 accepted/tizen/unified/20190926.065705 submit/tizen/20190925.082745 submit/tizen_5.5/20191031.000006 submit/tizen_5.5_mobile_hotfix/20201026.185106 submit/tizen_5.5_wearable_hotfix/20201026.184306 tizen_5.5.m2_release
authorYunmi Ha <yunmi.ha@samsung.com>
Fri, 20 Sep 2019 08:24:42 +0000 (17:24 +0900)
committerYunmi Ha <yunmi.ha@samsung.com>
Wed, 25 Sep 2019 05:38:40 +0000 (14:38 +0900)
Change-Id: I3bd470e897004af30402b1d4c643f6552e85a875
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
src/common/gum-file.c

index 77b08d3..6b3f71e 100755 (executable)
@@ -172,12 +172,17 @@ _copy_file_attributes (
     ssize_t attrs_size = 0;
     struct stat from_stat;
 
-    if (stat (from_path, &from_stat) < 0 ||
-        chmod (to_path, from_stat.st_mode) < 0 ||
-        lchown (to_path, from_stat.st_uid, from_stat.st_gid) < 0) {
+    if (lstat (from_path, &from_stat) < 0)
         return FALSE;
+
+    if (!S_ISLNK(from_stat.st_mode)) {
+        if (chmod(to_path, from_stat.st_mode) < 0)
+            return FALSE;
     }
 
+    if (lchown(to_path, from_stat.st_uid, from_stat.st_gid) < 0)
+        return FALSE;
+
     /* copy extended attributes */
 #if defined(HAVE_LLISTXATTR) && \
     defined(HAVE_LGETXATTR) && \