diff options
-rw-r--r-- | source3/client/clitar.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/source3/client/clitar.c b/source3/client/clitar.c index 5afff63de4..951947ecb2 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -372,10 +372,15 @@ static long unoct(char *p, int ndgs) } /**************************************************************************** -Compare two strings in a slash insensitive way +Compare two strings in a slash insensitive way, allowing s1 to match s2 +if s1 is an "initial" string (up to directory marker). Thus, if s2 is +a file in any subdirectory of s1, declare a match. ***************************************************************************/ -int strslashcmp(char *s1,char *s2) +static +int strslashcmp(char *s1, char *s2) { + char *s1_0=s1; + while(*s1 && *s2 && (*s1 == *s2 || tolower(*s1) == tolower(*s2) @@ -384,6 +389,17 @@ int strslashcmp(char *s1,char *s2) s1++; s2++; } + /* if s1 has a trailing slash, it compared equal, so s1 is an "initial" + string of s2. + */ + if (!*s1 && s1 != s1_0 && (*(s1-1) == '/' || *(s1-1) == '\\')) return 0; + + /* ignore trailing slash on s1 */ + if (!*s2 && (*s1 == '/' || *s1 == '\\') && !*(s1+1)) return 0; + + /* check for s1 is an "initial" string of s2 */ + if (*s2 == '/' || *s2 == '\\') return 0; + return *s1-*s2; } @@ -1128,11 +1144,6 @@ static void do_tar(file_info *finfo) strcpy(exclaim, cur_dir); *(exclaim+strlen(exclaim)-1)='\0'; - if (clipfind(cliplist, clipn, exclaim)) { - DEBUG(3,("Skipping directory %s\n", exclaim)); - return; - } - strcat(exclaim, "\\"); strcat(exclaim, finfo->name); |