*
* Copyright (C) 1996 Andrew Tridgell
* Copyright (C) 1996 Paul Mackerras
- * Copyright (C) 2003-2008 Wayne Davison
+ * Copyright (C) 2003-2009 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
extern int inc_recurse;
extern int inplace;
extern int flist_eof;
+extern int file_old_total;
extern int msgs2stderr;
extern int keep_dirlinks;
extern int make_backups;
-extern int delete_during;
-extern int check_for_io_err;
extern struct file_list *cur_flist, *first_flist, *dir_flist;
extern struct chmod_mode_struct *daemon_chmod_modes;
#ifdef ICONV_OPTION
if (DEBUG_GTE(CMD, 1))
print_child_argv("protected args:", args + i + 1);
do {
+ if (!args[i][0])
+ write_buf(fd, ".", 2);
#ifdef ICONV_OPTION
- if (convert) {
+ else if (convert) {
INIT_XBUF_STRLEN(inbuf, args[i]);
iconvbufs(ic_send, &inbuf, &outbuf,
ICB_EXPAND_OUT | ICB_INCLUDE_BAD | ICB_INCLUDE_INCOMPLETE);
outbuf.buf[outbuf.len] = '\0';
write_buf(fd, outbuf.buf, outbuf.len + 1);
outbuf.len = 0;
- } else
+ }
#endif
+ else
write_buf(fd, args[i], strlen(args[i]) + 1);
} while (args[++i]);
write_byte(fd, 0);
while (1) {
ndx = read_ndx(f_in);
- if (ndx >= 0) {
- if (check_for_io_err) {
- /* Let generator know there was no I/O error. */
- send_msg_int(MSG_IO_ERROR, 0);
- check_for_io_err = 0;
- }
+ if (ndx >= 0)
break;
- }
- check_for_io_err = 0;
if (ndx == NDX_DONE)
return ndx;
if (!inc_recurse || am_sender) {
stop_flist_forward();
if (!msgs2stderr)
negate_output_levels(); /* restore info/debug output */
- /* If the sender is going to send us an MSG_IO_ERROR value, it
- * will always be the very next message following a file list. */
- if (delete_during)
- check_for_io_err = 1;
}
iflags = protocol_version >= 29 ? read_shortint(f_in)
goto read_loop;
}
- cur_flist = flist_for_ndx(ndx, "read_ndx_and_attrs");
+ flist = flist_for_ndx(ndx, "read_ndx_and_attrs");
+ if (flist != cur_flist) {
+ cur_flist = flist;
+ if (am_sender) {
+ file_old_total = cur_flist->used;
+ for (flist = first_flist; flist != cur_flist; flist = flist->next)
+ file_old_total += flist->used;
+ }
+ }
if (iflags & ITEM_BASIS_TYPE_FOLLOWS)
fnamecmp_type = read_byte(f_in);
full_fname(fname));
return 0;
}
-#ifdef SUPPORT_ACLS
- sx2.acc_acl = sx2.def_acl = NULL;
-#endif
-#ifdef SUPPORT_XATTRS
- sx2.xattr = NULL;
-#endif
+ init_stat_x(&sx2);
sxp = &sx2;
inherit = !preserve_perms;
} else
flags |= ATTRS_SKIP_MTIME;
if (!(flags & ATTRS_SKIP_MTIME)
&& cmp_time(sxp->st.st_mtime, file->modtime) != 0) {
- int ret = set_modtime(fname, file->modtime, sxp->st.st_mode);
+ int ret = set_modtime(fname, file->modtime, F_MOD_NSEC(file), sxp->st.st_mode);
if (ret < 0) {
rsyserr(FERROR_XFER, errno, "failed to set times on %s",
full_fname(fname));
* If set_acl() changes permission bits in the process of setting
* an access ACL, it changes sxp->st.st_mode so we know whether we
* need to chmod(). */
- if (preserve_acls && !S_ISLNK(new_mode) && set_acl(fname, file, sxp) == 0)
- updated = 1;
+ if (preserve_acls && !S_ISLNK(new_mode)) {
+ if (set_acl(fname, file, sxp, new_mode) > 0)
+ updated = 1;
+ }
#endif
#ifdef HAVE_CHMOD
}
if (make_backups > 0 && overwriting_basis) {
- if (!make_backup(fname))
+ int ok = make_backup(fname, False);
+ if (!ok)
return 1;
- if (fnamecmp == fname)
+ if (ok == 1 && fnamecmp == fname)
fnamecmp = get_backup_name(fname);
}