X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/4ecf3e067151e45dc7dead9862416722dcb4a20f..d8d13893489ba8245d2ff1e67fbb5c46dd047ef6:/flist.c diff --git a/flist.c b/flist.c index 0554b5d7..18b239ef 100644 --- a/flist.c +++ b/flist.c @@ -1022,7 +1022,12 @@ static struct file_struct *recv_file_entry(struct file_list *flist, * and performing extensive checks against global options. * * Returns a pointer to the new file struct, or NULL if there was an error - * or this file should be excluded. */ + * or this file should be excluded. + * + * Note: Any error (here or in send_file_name) that results in the omission of + * an existent source file from the file list should set + * "io_error |= IOERR_GENERAL" to avoid deletion of the file from the + * destination if --delete is on. */ struct file_struct *make_file(const char *fname, struct file_list *flist, STRUCT_STAT *stp, int flags, int filter_level) { @@ -1039,6 +1044,7 @@ struct file_struct *make_file(const char *fname, struct file_list *flist, char *bp; if (strlcpy(thisname, fname, sizeof thisname) >= sizeof thisname) { + io_error |= IOERR_GENERAL; rprintf(FINFO, "skipping overly long name: %s\n", fname); return NULL; } @@ -1341,15 +1347,19 @@ static struct file_struct *send_file_name(int f, struct file_list *flist, if (preserve_acls && !S_ISLNK(file->mode)) { sx.st.st_mode = file->mode; sx.acc_acl = sx.def_acl = NULL; - if (get_acl(fname, &sx) < 0) + if (get_acl(fname, &sx) < 0) { + io_error |= IOERR_GENERAL; return NULL; + } } #endif #ifdef SUPPORT_XATTRS if (preserve_xattrs) { sx.xattr = NULL; - if (get_xattr(fname, &sx) < 0) + if (get_xattr(fname, &sx) < 0) { + io_error |= IOERR_GENERAL; return NULL; + } } #endif @@ -2154,7 +2164,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[]) if (inc_recurse) { send_dir_depth = 1; add_dirs_to_tree(-1, flist, dir_count); - if (!file_total || strcmp(flist->sorted[0]->basename, ".") != 0) + if (!file_total || strcmp(flist->sorted[0]->basename, ".") != 0) flist->parent_ndx = -1; flist_done_allocating(flist); if (send_dir_ndx < 0) { @@ -2278,7 +2288,7 @@ struct file_list *recv_file_list(int f) else io_error |= read_int(f); } else if (inc_recurse && flist->ndx_start == 1) { - if (!file_total || strcmp(flist->sorted[0]->basename, ".") != 0) + if (!file_total || strcmp(flist->sorted[0]->basename, ".") != 0) flist->parent_ndx = -1; }