summaryrefslogtreecommitdiff
path: root/flist.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2008-02-09 21:41:50 -0800
committerWayne Davison <wayned@samba.org>2008-02-09 21:41:50 -0800
commit21897ecbedeec3fbcaf2cbed895df6d11d811ba9 (patch)
treed4977182d7f9309d0b953f2a0c16273f7be21700 /flist.c
parent01103e18702edf1dc025e73761c52965132342eb (diff)
downloadrsync-21897ecbedeec3fbcaf2cbed895df6d11d811ba9.tar.gz
Improved the "symlink has no referent" logic to work with all the
--copy*links options.
Diffstat (limited to 'flist.c')
-rw-r--r--flist.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/flist.c b/flist.c
index 3616a8e2..a0970216 100644
--- a/flist.c
+++ b/flist.c
@@ -1037,9 +1037,15 @@ 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
- && S_ISLNK(st.st_mode)) {
+ /* When our options tell us to follow a symlink that
+ * points nowhere, tell the user about the symlink
+ * instead of giving a "vanished" message. We only
+ * dereference a symlink if one of the --copy*links
+ * options was specified, so there's no need for the
+ * extra lstat() if one of these options isn't on. */
+ if ((copy_links || copy_unsafe_links || copy_dirlinks)
+ && x_lstat(thisname, &st, NULL) == 0
+ && S_ISLNK(st.st_mode)) {
io_error |= IOERR_GENERAL;
rprintf(FERROR_XFER, "symlink has no referent: %s\n",
full_fname(thisname));