From cbb5fa4f07a6cb017a6a9ddbb8f33e3aa18d489a Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Wed, 25 May 2005 01:24:01 +0000 Subject: [PATCH] Handle nested "." dirs (caused by --relative and a trailing slash or a trailing "/.") in f_name_cmp() when dirname is not an identical pointer. --- flist.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/flist.c b/flist.c index ad02b898..5058cc5e 100644 --- a/flist.c +++ b/flist.c @@ -1680,8 +1680,13 @@ int f_name_cmp(struct file_struct *f1, struct file_struct *f2) break; case s_SLASH: type1 = S_ISDIR(f1->mode) ? t_path : t_ITEM; - state1 = s_BASE; c1 = (uchar*)f1->basename; + if (type1 == t_PATH && *c1 == '.' && !c1[1]) { + type1 = t_ITEM; + state1 = s_TRAILING; + c1 = (uchar*)""; + } else + state1 = s_BASE; break; case s_BASE: state1 = s_TRAILING; @@ -1705,8 +1710,13 @@ int f_name_cmp(struct file_struct *f1, struct file_struct *f2) break; case s_SLASH: type2 = S_ISDIR(f2->mode) ? t_path : t_ITEM; - state2 = s_BASE; c2 = (uchar*)f2->basename; + if (type2 == t_PATH && *c2 == '.' && !c2[1]) { + type2 = t_ITEM; + state2 = s_TRAILING; + c2 = (uchar*)""; + } else + state2 = s_BASE; break; case s_BASE: state2 = s_TRAILING; -- 2.34.1