diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-08-11 16:18:19 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-08-11 16:18:19 -0400 |
commit | 79640c29c5bcf8de20f013dcc80e1a9c7a93811f (patch) | |
tree | be84de2b0ef11dcc6d6796b411dbd0f2e4f7ca92 /tapsets.cxx | |
parent | 32a1dfe9c13094391dab645484e7563992f9ba53 (diff) | |
download | systemtap-steved-79640c29c5bcf8de20f013dcc80e1a9c7a93811f.tar.gz systemtap-steved-79640c29c5bcf8de20f013dcc80e1a9c7a93811f.tar.xz systemtap-steved-79640c29c5bcf8de20f013dcc80e1a9c7a93811f.zip |
PR5049: fix overbroad effects of naive "*" prefixing; instead use optional "*/" only.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r-- | tapsets.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tapsets.cxx b/tapsets.cxx index d4745b9f..af9fda52 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -858,11 +858,12 @@ struct dwflpp // PR 5049: implicit * in front of given path pattern. // NB: fnmatch() is used without FNM_PATHNAME. - string prefixed_pattern = string("*") + pattern; + string prefixed_pattern = string("*/") + pattern; - bool t = (fnmatch(prefixed_pattern.c_str(), cu_name.c_str(), 0) == 0); + bool t = (fnmatch(pattern.c_str(), cu_name.c_str(), 0) == 0 || + fnmatch(prefixed_pattern.c_str(), cu_name.c_str(), 0) == 0); if (t && sess.verbose>3) - clog << "pattern '" << prefixed_pattern << "' " + clog << "pattern '" << pattern << "' " << "matches " << "CU '" << cu_name << "'" << "\n"; return t; @@ -1372,7 +1373,7 @@ struct dwflpp // PR 5049: implicit * in front of given path pattern. // NB: fnmatch() is used without FNM_PATHNAME. - string prefixed_pattern = string("*") + pattern; + string prefixed_pattern = string("*/") + pattern; dwarf_assert ("dwarf_getsrcfiles", dwarf_getsrcfiles (cu, &srcfiles, &nfiles)); @@ -1380,7 +1381,8 @@ struct dwflpp for (size_t i = 0; i < nfiles; ++i) { char const * fname = dwarf_filesrc (srcfiles, i, NULL, NULL); - if (fnmatch (prefixed_pattern.c_str(), fname, 0) == 0) + if (fnmatch (pattern.c_str(), fname, 0) == 0 || + fnmatch (prefixed_pattern.c_str(), fname, 0) == 0) { filtered_srcfiles.insert (fname); if (sess.verbose>2) |