[lftp] Follow local symlinks when mirroring

Alexander V. Lukyanov lav at netis.ru
Tue Dec 6 09:01:26 MSK 2011


On Mon, Dec 05, 2011 at 03:16:05PM +0100, franck.eyraud at jrc.ec.europa.eu wrote:
> On 05/12/2011 13:47, franck.eyraud at jrc.ec.europa.eu wrote:
> >(I could try to contribute, if you think it would require few
> >changes, but I didn't work with c/c++ for a long time)
> I anyway had a curious look at the source code; I noticed at line
> 349 of MirrorJob.cc the following code :
>
>          if(target_is_local && !script_only)
>          {
>             if(lstat(target_name,&st)!=-1)

Please try this patch and report if it works well for you.
(use -L option).

--
   Alexander.
-------------- next part --------------
diff --git a/src/MirrorJob.cc b/src/MirrorJob.cc
index 4b945d6..af27f39 100644
--- a/src/MirrorJob.cc
+++ b/src/MirrorJob.cc
@@ -348,7 +348,7 @@ void  MirrorJob::HandleFile(FileInfo *file)
 	 }
 	 if(target_is_local && !script_only)
 	 {
-	    if(lstat(target_name,&st)!=-1)
+	    if((flags&RETR_SYMLINKS?stat:lstat)(target_name,&st)!=-1)
 	    {
 	       if(S_ISDIR(st.st_mode))
 	       {
@@ -693,7 +693,7 @@ int   MirrorJob::Do()
       if(target_is_local)
       {
 	 struct stat st;
-	 if(lstat(target_dir,&st)!=-1)
+	 if((flags&RETR_SYMLINKS?stat:lstat)(target_dir,&st)!=-1)
 	 {
 	    if(S_ISDIR(st.st_mode))
 	    {


More information about the lftp mailing list