Upload tizen_2.2 source
authorkh5325.kim <kh5325.kim@samsung.com>
Mon, 1 Jul 2013 15:22:23 +0000 (00:22 +0900)
committerkh5325.kim <kh5325.kim@samsung.com>
Mon, 1 Jul 2013 15:22:23 +0000 (00:22 +0900)
Change-Id: I84adf3c520cabaa8b1d8aa4d2590246818f5159b

src/file_sync_client.c
src/file_sync_functions.c

index 085083258651db6a6bc12d4e6c26ec9af61d1d0f..3a68b8d23213d058d19db781b8acf229bd1590d3 100644 (file)
@@ -100,8 +100,9 @@ static int file_copy(int src_fd, int dst_fd, char* srcp, char* dstp, FILE_FUNC*
             return -1;
         }
     }
-    srcF->readclose(src_fd);
-    dstF->writeclose(dst_fd, dstp, srcstat);
+    if(srcF->readclose(src_fd) < 0 || dstF->writeclose(dst_fd, dstp, srcstat) < 0) {
+        return -1;
+    }
     free(srcstat);
     return 1;
 }
@@ -170,10 +171,7 @@ int do_sync_copy(char* srcp, char* dstp, FILE_FUNC* srcF, FILE_FUNC* dstF, int i
             }
         }
         int result = file_copy(src_fd, dst_fd, srcp, dstp, srcF, dstF, &total_bytes);
-        if(result < 0) {
-            finalize(src_fd, dst_fd, srcF, dstF);
-            return 1;
-        }
+
         if(result == 1) {
             pushed++;
         }
@@ -232,10 +230,7 @@ int do_sync_copy(char* srcp, char* dstp, FILE_FUNC* srcF, FILE_FUNC* dstF, int i
                     if(src_dir == 0) {
                         fprintf(stderr,"push: %s -> %s\n", src_p, dst_p);
                         int result = file_copy(src_fd, dst_fd, src_p, dst_p, srcF, dstF, &total_bytes);
-                        if(result < 0) {
-                            finalize(src_fd, dst_fd, srcF, dstF);
-                            return 1;
-                        }
+
                         if(result == 1) {
                             pushed++;
                         }
@@ -257,13 +252,14 @@ int do_sync_copy(char* srcp, char* dstp, FILE_FUNC* srcF, FILE_FUNC* dstF, int i
         }
     }
 
-    char command[6] = {'p', 'u', 's', 'h', 'e', 'd'};
     if(srcF == &REMOTE_FILE_FUNC) {
-        strncpy(command, "pulled", sizeof command);
+        fprintf(stderr,"%d file(s) %s. %d file(s) skipped.\n",
+                pushed, "pulled", skiped);
+    }
+    else {
+        fprintf(stderr,"%d file(s) %s. %d file(s) skipped.\n",
+                pushed, "pushed", skiped);
     }
-
-    fprintf(stderr,"%d file(s) %s. %d file(s) skipped.\n",
-            pushed, command, skiped);
 
     long long end_time = NOW() - start_time;
 
index b0e97968203f78b770fd9810ba0d83e1967b93ba..bd2a8eab1fe3958f991199ecb732b38e4951b8e4 100644 (file)
@@ -292,7 +292,7 @@ int writeclose_remote(int fd, char* dstp, void* stat) {
                 len = 255;
             }
             if(readx(fd, buf, len)) {
-                fprintf(stderr, "cannot close remote file '%s' and its failed msg. %s\n", dstp, strerror(errno));
+                fprintf(stderr, "cannot close remote file '%s' and its failed msg.\n", dstp);
                 return -1;
             }
             buf[len] = 0;
@@ -300,7 +300,7 @@ int writeclose_remote(int fd, char* dstp, void* stat) {
             strcpy(buf, "unknown reason");
         }
 
-        fprintf(stderr,"cannot close remote file '%s' with failed msg '%s'. %s\n", dstp, buf, strerror(errno));
+        fprintf(stderr,"cannot close remote file '%s' with failed msg '%s'.\n", dstp, buf);
         return -1;
     }