Fixed a bunch of "warn_unused_result" compiler warnings.
[rsync/rsync.git] / receiver.c
index b342afa..7efd3d2 100644 (file)
@@ -285,8 +285,12 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
                goto report_write_error;
 
 #ifdef HAVE_FTRUNCATE
-       if (inplace && fd != -1)
-               ftruncate(fd, offset);
+       if (inplace && fd != -1) {
+               if (ftruncate(fd, offset) < 0) {
+                       rsyserr(FWARNING, errno, "ftruncate failed on %s",
+                               full_fname(fname));
+               }
+       }
 #endif
 
        if (INFO_GTE(PROGRESS, 1))
@@ -487,6 +491,21 @@ int recv_files(int f_in, char *local_name)
                        if (preserve_xattrs && iflags & ITEM_REPORT_XATTR && !dry_run)
                                set_file_attrs(fname, file, NULL, fname, 0);
 #endif
+                       if (iflags & ITEM_IS_NEW) {
+                               stats.created_files++;
+                               if (S_ISREG(file->mode)) {
+                                       /* Nothing further to count. */
+                               } else if (S_ISDIR(file->mode))
+                                       stats.created_dirs++;
+#ifdef SUPPORT_LINKS
+                               else if (S_ISLNK(file->mode))
+                                       stats.created_symlinks++;
+#endif
+                               else if (IS_DEVICE(file->mode))
+                                       stats.created_devices++;
+                               else
+                                       stats.created_specials++;
+                       }
                        continue;
                }
                if (phase == 2) {
@@ -516,11 +535,13 @@ int recv_files(int f_in, char *local_name)
                                csum_length = SHORT_SUM_LENGTH;
                                redoing = 0;
                        }
+                       if (iflags & ITEM_IS_NEW)
+                               stats.created_files++;
                }
 
                if (!am_server && INFO_GTE(PROGRESS, 1))
                        set_current_file_index(file, ndx);
-               stats.num_transferred_files++;
+               stats.xferred_files++;
                stats.total_transferred_size += F_LENGTH(file);
 
                cleanup_got_literal = 0;
@@ -808,6 +829,11 @@ int recv_files(int f_in, char *local_name)
        if (phase == 2 && delay_updates) /* for protocol_version < 29 */
                handle_delayed_updates(local_name);
 
+       if (read_batch) {
+               read_int(batch_gen_fd); /* Discard -1 */
+               read_del_stats(batch_gen_fd);
+       }
+
        if (DEBUG_GTE(RECV, 1))
                rprintf(FINFO,"recv_files finished\n");