Modify the file permission mode in push/pull operation.
authorKim Gunsoo <gunsoo83.kim@samsung.com>
Wed, 8 Jul 2015 09:39:06 +0000 (18:39 +0900)
committerKim Gunsoo <gunsoo83.kim@samsung.com>
Wed, 8 Jul 2015 09:39:06 +0000 (18:39 +0900)
- Synchronize the permission mode of SDB with Connection Explorer.

Change-Id: I67e7e873c4e5e0c39c7ccbe948ef2a7cd0976d50
Signed-off-by: Kim Gunsoo <gunsoo83.kim@samsung.com>
src/file_sync_functions.c

index b972f1eeccea65f763136251a3bad07d7a94428b..bca3e4cea2ef2d0ed0944ed553b0b043931e36b9 100644 (file)
@@ -125,6 +125,9 @@ int _stat_local(int fd, char* path, struct stat* st, int print_err) {
         return -1;
     }
 
+    /* Synchronize the permission mode of SDB with Connection Explorer */
+    st->st_mode = (st->st_mode & 0777000) | 0755;
+
     return 0;
 }
 
@@ -234,11 +237,18 @@ int readclose_remote(int fd) {
 }
 
 int writeopen_local(int fd, char* dstp, struct stat* st) {
+    mode_t mask, mode;
+
     D("write open local file 'fd:%d' '%s'\n", fd, dstp);
     unix_unlink(dstp);
     mkdirs(dstp);
 //    mkdir(dstp, 0755);
-    fd = sdb_creat(dstp, 0644);
+
+    /* Synchronize the permission mode of SDB with Connection Explorer */
+    mask = umask(0);
+    umask(mask);
+    mode = 0666 & (~mask);
+    fd = sdb_creat(dstp, mode);
 
     if(fd < 0) {
         print_error(SDB_MESSAGE_ERROR, F(ERR_SYNC_CREATE_FAIL, dstp), strerror(errno));