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
My version of Matt's improvements related to missing source args:
[rsync/rsync.git]
/
generator.c
diff --git
a/generator.c
b/generator.c
index
fdfc8dd
..
a9f9306
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 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;
@@
-89,7
+90,6
@@
extern int unsort_ndx;
extern int max_delete;
extern int force_delete;
extern int one_file_system;
extern int max_delete;
extern int force_delete;
extern int one_file_system;
-extern int check_for_io_err;
extern struct stats stats;
extern dev_t filesystem_dev;
extern mode_t orig_umask;
extern struct stats stats;
extern dev_t filesystem_dev;
extern mode_t orig_umask;
@@
-98,7
+98,7
@@
extern char *backup_dir;
extern char *backup_suffix;
extern int backup_suffix_len;
extern struct file_list *cur_flist, *first_flist, *dir_flist;
extern char *backup_suffix;
extern int backup_suffix_len;
extern struct file_list *cur_flist, *first_flist, *dir_flist;
-extern struct filter_list_struct daemon_filter_list;
+extern struct filter_list_struct
filter_list,
daemon_filter_list;
int ignore_perishable = 0;
int non_perishable_cnt = 0;
int ignore_perishable = 0;
int non_perishable_cnt = 0;
@@
-522,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;
@@
-698,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);
@@
-1122,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)))
@@
-1220,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 (missing_args == 2 && f->mode == 0) {
+ 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));
@@
-1367,6
+1374,14
@@
static void recv_generator(char *fname, struct file_struct *file, int ndx,
stat_errno = errno;
}
stat_errno = errno;
}
+ if (missing_args == 2 && file->mode == 0) {
+ if (filter_list.head && check_filter(&filter_list, FINFO, fname, is_dir) < 0)
+ return;
+ 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)
@@
-1611,8
+1626,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)) {
@@
-1626,7
+1645,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)
@@
-2135,10
+2154,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. */
@@
-2237,10
+2255,6
@@
void generate_files(int f_out, const char *local_name)
dirdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp));
} else
dirdev = MAKEDEV(0, 0);
dirdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp));
} else
dirdev = MAKEDEV(0, 0);
- /* We must be sure we've had a chance to receive an I/O
- * error for this directory before we delete in it. */
- while (check_for_io_err && !cur_flist->next)
- wait_for_receiver();
delete_in_dir(fbuf, fp, &dirdev);
} else
change_local_filter_dir(fbuf, strlen(fbuf), F_DEPTH(fp));
delete_in_dir(fbuf, fp, &dirdev);
} else
change_local_filter_dir(fbuf, strlen(fbuf), F_DEPTH(fp));