summaryrefslogtreecommitdiff
path: root/apt-pkg/algorithms.cc
diff options
context:
space:
mode:
authorEugene V. Lyubimkin <jackyf@1501-debian>2008-10-25 22:49:22 +0300
committerEugene V. Lyubimkin <jackyf@1501-debian>2008-10-25 22:49:22 +0300
commit2d6f9accbcf38923911854a918d971c0905b262c (patch)
treead9a2b64e37eb622aac187e2f421b0c1ca422566 /apt-pkg/algorithms.cc
parent27d5a2046999b86605968e7cbf0778dd95e63371 (diff)
Corrected determining if regexp matched.
Diffstat (limited to 'apt-pkg/algorithms.cc')
-rw-r--r--apt-pkg/algorithms.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index bd59a4749..6f30a52da 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -1348,8 +1348,8 @@ bool ListUpdate(pkgAcquireStatus &Stat,
regex_t userPassRegex;
regcomp(&userPassRegex, "\\://(\\w+)\\:(\\w+)@", REG_EXTENDED);
regmatch_t userPassMatch;
- regexec(&userPassRegex, descUri.c_str(), 1, &userPassMatch, 0);
- if (userPassMatch.rm_so != -1) // regexp matched
+ int regMatchResult = regexec(&userPassRegex, descUri.c_str(), 1, &userPassMatch, 0);
+ if (regMatchResult == 0 && userPassMatch.rm_so != -1) // regexp matched
{
// really stripping
size_t stripStart = userPassMatch.rm_so + 3;
@@ -1357,6 +1357,7 @@ bool ListUpdate(pkgAcquireStatus &Stat,
descUri = descUri.substr(0, stripStart) +
descUri.substr(stripEnd, string::npos);
}
+ regfree(&userPassRegex);
_error->Warning(_("Failed to fetch %s %s\n"), descUri.c_str(),
(*I)->ErrorText.c_str());