From: Andrew Tridgell Date: Sat, 29 Jan 2000 02:35:01 +0000 (+0000) Subject: runtime detect fnmatch() bug if ** is used. X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/9bec5286063b7e9210f945c68a738e96662a37ec runtime detect fnmatch() bug if ** is used. its all too common to compile with a working libc and run on a broken one. --- diff --git a/exclude.c b/exclude.c index 1b5373d3..a43a84a5 100644 --- a/exclude.c +++ b/exclude.c @@ -52,7 +52,17 @@ static struct exclude_struct *make_exclude(char *pattern, int include) if (strpbrk(pattern, "*[?")) { ret->regular_exp = 1; - ret->fnmatch_flags = strstr(pattern, "**") ? 0 : FNM_PATHNAME; + ret->fnmatch_flags = FNM_PATHNAME; + if (strstr(pattern, "**")) { + static int tested; + if (!tested) { + tested = 1; + if (fnmatch("a/b/*", "a/b/c/d", FNM_PATHNAME)==0) { + rprintf(FERROR,"WARNING: fnmatch FNM_PATHNAME is broken on your system\n"); + } + } + ret->fnmatch_flags = 0; + } } if (strlen(pattern) > 1 && pattern[strlen(pattern)-1] == '/') {