Some demon_log_* variables changed into logfile_* variables that are
[rsync/rsync.git] / receiver.c
index 8518fbf..94b6fb4 100644 (file)
@@ -1,49 +1,46 @@
-/* -*- c-file-style: "linux" -*-
-
-   Copyright (C) 1996-2000 by Andrew Tridgell
-   Copyright (C) Paul Mackerras 1996
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+/*
+ * Routines only used by the receiving process.
+ *
+ * Copyright (C) 1996-2000 Andrew Tridgell
+ * Copyright (C) 1996 Paul Mackerras
+ * Copyright (C) 2003, 2004, 2005, 2006 Wayne Davison
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
 
 #include "rsync.h"
 
 extern int verbose;
 extern int do_xfers;
-extern int am_daemon;
 extern int am_server;
 extern int do_progress;
 extern int log_before_transfer;
 extern int log_format_has_i;
-extern int daemon_log_format_has_i;
+extern int logfile_format_has_i;
 extern int csum_length;
 extern int read_batch;
 extern int write_batch;
 extern int batch_gen_fd;
 extern int protocol_version;
 extern int relative_paths;
-extern int keep_dirlinks;
 extern int preserve_hard_links;
 extern int preserve_perms;
-extern int io_error;
 extern int basis_dir_cnt;
 extern int make_backups;
 extern int cleanup_got_literal;
 extern int remove_sent_files;
-extern int module_id;
-extern int ignore_errors;
 extern int append_mode;
 extern int sparse_files;
 extern int keep_partial;
@@ -345,8 +342,7 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
        struct file_struct *file;
        struct stats initial_stats;
        int save_make_backups = make_backups;
-       int itemizing = am_daemon ? daemon_log_format_has_i
-                     : !am_server && log_format_has_i;
+       int itemizing = am_server ? logfile_format_has_i : log_format_has_i;
        int max_phase = protocol_version >= 29 ? 2 : 1;
        int i, recv_ok;
 
@@ -619,9 +615,14 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
                }
 
                if ((recv_ok && (!delay_updates || !partialptr)) || inplace) {
-                       if (partialptr == fname || *partial_dir == '/')
-                               partialptr = NULL;
-                       finish_transfer(fname, fnametmp, partialptr,
+                       char *temp_copy_name;
+                       if (partialptr == fname)
+                               partialptr = temp_copy_name = NULL;
+                       else if (*partial_dir == '/')
+                               temp_copy_name = NULL;
+                       else
+                               temp_copy_name = partialptr;
+                       finish_transfer(fname, fnametmp, temp_copy_name,
                                        file, recv_ok, 1);
                        if (fnamecmp == partialptr) {
                                do_unlink(partialptr);