[PATCH] Extend "symlink has no referent" message to
--copy-unsafe-links.
Matt McCutchen
matt at mattmccutchen.net
Wed Jan 30 02:07:40 GMT 2008
---
Wayne, please check my comment to see whether I have understood the code
correctly.
flist.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/flist.c b/flist.c
index 3616a8e..7b0fa13 100644
--- a/flist.c
+++ b/flist.c
@@ -1037,8 +1037,14 @@ struct file_struct *make_file(const char *fname, struct file_list *flist,
}
if (save_errno == ENOENT) {
#ifdef SUPPORT_LINKS
- /* Avoid "vanished" error if symlink points nowhere. */
- if (copy_links && x_lstat(thisname, &st, NULL) == 0
+ /* When our options tell us to follow a symlink that
+ * points nowhere, state that instead of giving the
+ * "vanished" message. This case applies whenever the
+ * symlink exists, but the symlink can only exist with
+ * --copy-links or --copy-unsafe-links, so we avoid the
+ * extra lstat when neither of those options is on. */
+ if ((copy_links || copy_unsafe_links)
+ && x_lstat(thisname, &st, NULL) == 0
&& S_ISLNK(st.st_mode)) {
io_error |= IOERR_GENERAL;
rprintf(FERROR_XFER, "symlink has no referent: %s\n",
--
1.5.4.rc3.15.g4bbc
More information about the rsync
mailing list