X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/8250d8a1c60b58f730333d9becf9881ca2b78828..b43db229b74ad8457539eb771e9733aeeccffb6f:/generator.c diff --git a/generator.c b/generator.c index 8d944dc0..ec33d5a3 100644 --- a/generator.c +++ b/generator.c @@ -50,6 +50,7 @@ extern int delete_mode; extern int delete_before; extern int delete_during; extern int delete_after; +extern int delete_missing_args; extern int msgdone_cnt; extern int ignore_errors; extern int remove_source_files; @@ -700,7 +701,7 @@ void itemize(const char *fnamecmp, struct file_struct *file, int ndx, int statre if (iflags & ITEM_XNAME_FOLLOWS) write_vstring(sock_f_out, xname, strlen(xname)); #ifdef SUPPORT_XATTRS - if (preserve_xattrs && !dry_run + if (preserve_xattrs && do_xfers && iflags & (ITEM_REPORT_XATTR|ITEM_TRANSFER)) { send_xattr_request(NULL, file, iflags & ITEM_REPORT_XATTR ? sock_f_out : -1); @@ -1124,8 +1125,8 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx, } switch (type) { case TYPE_DIR: - break; case TYPE_SPECIAL: + break; case TYPE_DEVICE: devp = F_RDEV_P(file); if (sxp->st.st_rdev != MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp))) @@ -1222,7 +1223,11 @@ static void list_file_entry(struct file_struct *f) f_name(f, NULL), F_SYMLINK(f)); } else #endif - { + if (delete_missing_args && !f->mode) { + rprintf(FINFO, "%-*s %s\n", + /*colwidth*/11 + 31, "*missing", + f_name(f, NULL)); + } else { rprintf(FINFO, "%s %11.0f %s %s\n", permbuf, len, timestring(f->modtime), f_name(f, NULL)); @@ -1369,6 +1374,12 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, stat_errno = errno; } + if (delete_missing_args && file->mode == 0) { + if (statret == 0) + delete_item(fname, sx.st.st_mode, del_opts); + return; + } + if (ignore_non_existing > 0 && statret == -1 && stat_errno == ENOENT) { if (is_dir) { if (is_dir < 0) @@ -1613,8 +1624,12 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, if ((am_root && preserve_devices && IS_DEVICE(file->mode)) || (preserve_specials && IS_SPECIAL(file->mode))) { - uint32 *devp = F_RDEV_P(file); - dev_t rdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp)); + dev_t rdev; + if (IS_DEVICE(file->mode)) { + uint32 *devp = F_RDEV_P(file); + rdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp)); + } else + rdev = 0; if (statret == 0) { int del_for_flag; if (IS_DEVICE(file->mode)) { @@ -1628,7 +1643,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, } if (statret == 0 && BITS_EQUAL(sx.st.st_mode, file->mode, _S_IFMT) - && sx.st.st_rdev == rdev) { + && (IS_SPECIAL(sx.st.st_mode) || sx.st.st_rdev == rdev)) { /* The device or special file is identical. */ set_file_attrs(fname, file, &sx, NULL, maybe_ATTRS_REPORT); if (itemizing)