diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2010-08-28 22:26:32 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2010-08-28 22:26:32 +0200 |
commit | b093a199056673b55e6467ab9e22e8af15183c43 (patch) | |
tree | a7e26503f1f4325691612a6be4ed20233bcfe58e /apt-pkg/contrib/configuration.cc | |
parent | e56aac77a45e7a9a5620be12dfae0e2296f1d560 (diff) |
* apt-pkg/contrib/configuration.cc:
- fix autoremove by using correct config-option name and
don't make faulty assumptions in error handling (Closes: #594689)
Diffstat (limited to 'apt-pkg/contrib/configuration.cc')
-rw-r--r-- | apt-pkg/contrib/configuration.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index 81cc87d15..cc7093fe2 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -857,19 +857,27 @@ Configuration::MatchAgainstConfig::MatchAgainstConfig(char const * Config) { regfree(p); delete p; + clearPatterns(); _error->Warning("Regex compilation error for '%s' in configuration option '%s'", s->c_str(), Config); + return; } - } - + } + if (strings.size() == 0) + patterns.push_back(NULL); } /*}}}*/ // MatchAgainstConfig Destructor /*{{{*/ Configuration::MatchAgainstConfig::~MatchAgainstConfig() { + clearPatterns(); +} +void Configuration::MatchAgainstConfig::clearPatterns() +{ for(std::vector<regex_t *>::const_iterator p = patterns.begin(); p != patterns.end(); ++p) { + if (*p == NULL) continue; regfree(*p); delete *p; } @@ -880,7 +888,7 @@ bool Configuration::MatchAgainstConfig::Match(char const * str) const { for(std::vector<regex_t *>::const_iterator p = patterns.begin(); p != patterns.end(); ++p) - if (regexec(*p, str, 0, 0, 0) == 0) + if (*p != NULL && regexec(*p, str, 0, 0, 0) == 0) return true; return false; |