- 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 (exclude_level != NO_EXCLUDES
- && check_exclude_file(thisname, 0, exclude_level)) {
- /* file is excluded anyway, ignore silently */
- return NULL;
+ /* See if file is excluded before reporting an error. */
+ if (exclude_level != NO_EXCLUDES
+ && check_exclude_file(thisname, 0, exclude_level))
+ return NULL;
+ if (save_errno == ENOENT) {
+#if SUPPORT_LINKS
+ /* Avoid "vanished" error if symlink points nowhere. */
+ if (copy_links && do_lstat(thisname, &st) == 0
+ && S_ISLNK(st.st_mode)) {
+ io_error |= IOERR_GENERAL;
+ rprintf(FERROR, "symlink has no referent: %s\n",
+ full_fname(thisname));
+ } else
+#endif
+ {
+ enum logcode c = am_daemon && protocol_version < 28
+ ? FERROR : FINFO;
+ io_error |= IOERR_VANISHED;
+ rprintf(c, "file has vanished: %s\n",
+ full_fname(thisname));