X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/7cf8e8d05da57806a784d8d26932731fd5b9d195..00ed4b5bf3e0980b62327c88445d11cc60fb164e:/flist.c diff --git a/flist.c b/flist.c index 873ffb8b..00076561 100644 --- a/flist.c +++ b/flist.c @@ -33,6 +33,7 @@ extern int verbose; extern int do_progress; extern int am_root; extern int am_server; +extern int am_daemon; extern int always_checksum; extern int module_id; extern int ignore_errors; @@ -46,7 +47,6 @@ extern char *files_from; extern int filesfrom_fd; extern int one_file_system; -extern int make_backups; extern int preserve_links; extern int preserve_hard_links; extern int preserve_perms; @@ -367,11 +367,12 @@ void send_file_entry(struct file_struct *file, int f, unsigned short base_flags) } else rdev = 0; } else if (IS_DEVICE(mode)) { - if ((file->u.rdev & ~0xFF) == rdev_high) + if ((file->u.rdev & ~(DEV64_T)0xFF) == rdev_high) { flags |= XMIT_SAME_HIGH_RDEV; - else { rdev = file->u.rdev; - rdev_high = rdev & ~0xFF; + } else { + rdev = file->u.rdev; + rdev_high = rdev & ~(DEV64_T)0xFF; } } } @@ -594,7 +595,7 @@ void receive_file_entry(struct file_struct **fptr, unsigned short flags, } else if (IS_DEVICE(mode)) { if (!(flags & XMIT_SAME_HIGH_RDEV)) { rdev = (DEV64_T)read_int(f); - rdev_high = rdev & ~0xFF; + rdev_high = rdev & ~(DEV64_T)0xFF; } else rdev = rdev_high | (DEV64_T)read_byte(f); } @@ -659,10 +660,8 @@ void receive_file_entry(struct file_struct **fptr, unsigned short flags, #if SUPPORT_HARD_LINKS if (preserve_hard_links && protocol_version < 28 && S_ISREG(mode)) flags |= XMIT_HAS_IDEV_DATA; - if (flags & XMIT_HAS_IDEV_DATA && flist->hlink_pool) { + if (flags & XMIT_HAS_IDEV_DATA) { INO64_T inode; - file->link_u.idev = pool_talloc(flist->hlink_pool, - struct idev, 1, "inode_table"); if (protocol_version < 26) { dev = read_int(f); inode = read_int(f); @@ -672,6 +671,8 @@ void receive_file_entry(struct file_struct **fptr, unsigned short flags, inode = read_longint(f); } if (flist->hlink_pool) { + file->link_u.idev = pool_talloc(flist->hlink_pool, + struct idev, 1, "inode_table"); file->F_INODE = inode; file->F_DEV = dev; } @@ -732,6 +733,8 @@ struct file_struct *make_file(char *fname, char *basename, *dirname, *bp; unsigned short flags = 0; + if (!flist) /* lastdir isn't valid if flist is NULL */ + lastdir_len = -1; if (strlcpy(thisname, fname, sizeof thisname) >= sizeof thisname - flist_dir_len) { @@ -746,18 +749,26 @@ struct file_struct *make_file(char *fname, if (readlink_stat(thisname, &st, linkname) != 0) { int save_errno = errno; - if (errno == ENOENT && exclude_level != NO_EXCLUDES) { + if (errno == ENOENT) { + enum logcode c = am_daemon && protocol_version < 28 + ? FERROR : FINFO; /* either symlink pointing nowhere or file that * was removed during rsync run; see if excluded * before reporting an error */ - if (check_exclude_file(thisname, 0, exclude_level)) { + if (exclude_level != NO_EXCLUDES + && check_exclude_file(thisname, 0, exclude_level)) { /* file is excluded anyway, ignore silently */ return NULL; } + io_error |= IOERR_VANISHED; + rprintf(c, "file has vanished: %s\n", + full_fname(thisname)); + } + else { + io_error |= IOERR_GENERAL; + rprintf(FERROR, "readlink %s failed: %s\n", + full_fname(thisname), strerror(save_errno)); } - io_error |= IOERR_GENERAL; - rprintf(FERROR, "readlink %s failed: %s\n", - full_fname(thisname), strerror(save_errno)); return NULL; }