/*
- Copyright (C) Andrew Tridgell 1996
- 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 sending process.
+ *
+ * Copyright (C) 1996 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 am_server;
extern int am_daemon;
extern int log_before_transfer;
-extern int log_format_has_i;
-extern int daemon_log_format_has_i;
+extern int stdout_format_has_i;
+extern int logfile_format_has_i;
extern int csum_length;
extern int append_mode;
extern int io_error;
extern int allowed_lull;
extern int protocol_version;
-extern int remove_sent_files;
+extern int remove_source_files;
extern int updating_basis_file;
extern int make_backups;
extern int do_progress;
extern int write_batch;
extern struct stats stats;
extern struct file_list *the_file_list;
-extern char *log_format;
+extern char *stdout_format;
/**
return;
file = the_file_list->files[ndx];
- /* The generator might tell us about symlinks we didn't send. */
- if (!(file->flags & FLAG_SENT) && !S_ISLNK(file->mode))
- return;
if (file->dir.root) {
offset = stringjoin(fname, sizeof fname,
file->dir.root, "/", NULL);
} else
offset = 0;
f_name(file, fname + offset);
- if (remove_sent_files && do_unlink(fname) == 0 && verbose > 1)
- rprintf(FINFO, "sender removed %s\n", fname + offset);
+ if (remove_source_files) {
+ if (do_unlink(fname) == 0) {
+ if (verbose > 1)
+ rprintf(FINFO, "sender removed %s\n", fname + offset);
+ } else
+ rsyserr(FERROR, errno, "sender failed to remove %s", fname + offset);
+ }
}
static void write_ndx_and_attrs(int f_out, int ndx, int iflags,
int phase = 0, max_phase = protocol_version >= 29 ? 2 : 1;
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 : stdout_format_has_i;
+ enum logcode log_code = log_before_transfer ? FLOG : FINFO;
int f_xfer = write_batch < 0 ? batch_fd : f_out;
int i, j;
stats.total_transferred_size += file->length;
if (!do_xfers) { /* log the transfer */
- if (!am_server && log_format)
- log_item(file, &stats, iflags, NULL);
+ log_item(FCLIENT, file, &stats, iflags, NULL);
write_ndx_and_attrs(f_out, i, iflags, fnamecmp_type,
xname, xlen);
continue;
rprintf(FINFO, "calling match_sums %s\n", fname);
if (log_before_transfer)
- log_item(file, &initial_stats, iflags, NULL);
+ log_item(FCLIENT, file, &initial_stats, iflags, NULL);
else if (!am_server && verbose && do_progress)
- rprintf(FINFO, "%s\n", fname2);
+ rprintf(FCLIENT, "%s\n", fname2);
set_compression(fname);
if (do_progress)
end_progress(st.st_size);
- if (!log_before_transfer)
- log_item(file, &initial_stats, iflags, NULL);
+ log_item(log_code, file, &initial_stats, iflags, NULL);
if (mbuf) {
j = unmap_file(mbuf);