Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Made --list-only output missing args as a "*missing" line.
[rsync/rsync.git]
/
generator.c
diff --git
a/generator.c
b/generator.c
index
2007931
..
ec33d5a
100644
(file)
--- a/
generator.c
+++ b/
generator.c
@@
-4,7
+4,7
@@
* Copyright (C) 1996-2000 Andrew Tridgell
* Copyright (C) 1996 Paul Mackerras
* Copyright (C) 2002 Martin Pool <mbp@samba.org>
* Copyright (C) 1996-2000 Andrew Tridgell
* Copyright (C) 1996 Paul Mackerras
* Copyright (C) 2002 Martin Pool <mbp@samba.org>
- * Copyright (C) 2003-200
8
Wayne Davison
+ * Copyright (C) 2003-200
9
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
*
* 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
@@
-50,6
+50,7
@@
extern int delete_mode;
extern int delete_before;
extern int delete_during;
extern int delete_after;
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;
extern int msgdone_cnt;
extern int ignore_errors;
extern int remove_source_files;
@@
-521,7
+522,10
@@
static void delete_in_dir(char *fbuf, struct file_struct *file, dev_t *fs_dev)
f_name(fp, NULL));
continue;
}
f_name(fp, NULL));
continue;
}
- if (flist_find(cur_flist, fp) < 0) {
+ /* Here we want to match regardless of file type. Replacement
+ * of a file with one of another type is handled separately by
+ * a delete_item call with a DEL_MAKE_ROOM flag. */
+ if (flist_find_ignore_dirness(cur_flist, fp) < 0) {
int flags = DEL_RECURSE;
if (!(fp->mode & S_IWUSR) && !am_root && (uid_t)F_OWNER(fp) == our_uid)
flags |= DEL_NO_UID_WRITE;
int flags = DEL_RECURSE;
if (!(fp->mode & S_IWUSR) && !am_root && (uid_t)F_OWNER(fp) == our_uid)
flags |= DEL_NO_UID_WRITE;
@@
-697,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 (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);
&& iflags & (ITEM_REPORT_XATTR|ITEM_TRANSFER)) {
send_xattr_request(NULL, file,
iflags & ITEM_REPORT_XATTR ? sock_f_out : -1);
@@
-1121,8
+1125,8
@@
static int try_dests_non(struct file_struct *file, char *fname, int ndx,
}
switch (type) {
case TYPE_DIR:
}
switch (type) {
case TYPE_DIR:
- break;
case TYPE_SPECIAL:
case TYPE_SPECIAL:
+ break;
case TYPE_DEVICE:
devp = F_RDEV_P(file);
if (sxp->st.st_rdev != MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp)))
case TYPE_DEVICE:
devp = F_RDEV_P(file);
if (sxp->st.st_rdev != MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp)))
@@
-1219,7
+1223,11
@@
static void list_file_entry(struct file_struct *f)
f_name(f, NULL), F_SYMLINK(f));
} else
#endif
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));
rprintf(FINFO, "%s %11.0f %s %s\n",
permbuf, len, timestring(f->modtime),
f_name(f, NULL));
@@
-1366,6
+1374,12
@@
static void recv_generator(char *fname, struct file_struct *file, int ndx,
stat_errno = errno;
}
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)
if (ignore_non_existing > 0 && statret == -1 && stat_errno == ENOENT) {
if (is_dir) {
if (is_dir < 0)
@@
-1610,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))) {
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)) {
if (statret == 0) {
int del_for_flag;
if (IS_DEVICE(file->mode)) {
@@
-1625,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)
}
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)
/* The device or special file is identical. */
set_file_attrs(fname, file, &sx, NULL, maybe_ATTRS_REPORT);
if (itemizing)
@@
-2134,10
+2152,9
@@
void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
if (first_flist->in_progress || first_flist->to_redo)
break;
if (first_flist->in_progress || first_flist->to_redo)
break;
- if (!read_batch) {
- write_ndx(sock_f_out, NDX_DONE);
+ write_ndx(sock_f_out, NDX_DONE);
+ if (!read_batch)
maybe_flush_socket(1);
maybe_flush_socket(1);
- }
if (delete_during == 2 || !dir_tweaking) {
/* Skip directory touch-up. */
if (delete_during == 2 || !dir_tweaking) {
/* Skip directory touch-up. */
@@
-2282,9
+2299,6
@@
void generate_files(int f_out, const char *local_name)
}
} while ((cur_flist = cur_flist->next) != NULL);
}
} while ((cur_flist = cur_flist->next) != NULL);
- if (read_batch && inc_recurse)
- write_ndx(f_out, NDX_DONE);
-
if (delete_during)
delete_in_dir(NULL, NULL, &dev_zero);
phase++;
if (delete_during)
delete_in_dir(NULL, NULL, &dev_zero);
phase++;