On Tue, Jan 07, 2003 at 02:16:17PM -0500, Glenn Maynard wrote:
> On Tue, Jan 07, 2003 at 03:58:36PM +0100, Piotr Krukowiecki wrote:
> > Even after cd /Anime find won't work :(
>
> This is a bug, however. The problem is that it's checking the first
> path ("." in /Anime) like any other argument, seeing it's a symlink, and
> not recursing (it only recurses on directories). I think the solution
> is the same as the above, except only on top-level stack entries.
How about this patch?
--
Alexander. | http://www.yars.free.net/~lav/
Index: GetFileInfo.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/GetFileInfo.cc,v
retrieving revision 1.23
diff -u -p -r1.23 GetFileInfo.cc
--- GetFileInfo.cc 2002/12/10 11:03:30 1.23
+++ GetFileInfo.cc 2003/01/15 11:48:06
@@ -96,10 +96,19 @@ GetFileInfo::GetFileInfo(FileAccess *a,
li=0;
from_cache=0;
saved_error_text=0;
- was_directory=0;
+ was_directory=false;
prepend_path=true;
origdir=xstrdup(session->GetCwd());
+
+ const char *bn=basename_ptr(dir);
+ if(bn[0]=='.' && (bn[1]==0 || bn[1]=='/' ||
+ (bn[1]=='.' && (bn[2]==0 || bn[2]=='/')))
+ || bn[0]=='/')
+ {
+ // . .. / are directories, don't try them as a file.
+ tried_file=true;
+ }
}
GetFileInfo::~GetFileInfo()
@@ -281,6 +290,10 @@ int GetFileInfo::Do()
result = new FileSet;
result->Add(fi);
+
+ xfree(path_to_prefix);
+ path_to_prefix=dirname_alloc(dir);
+
state=DONE;
return MOVED;
}