Commit f6c06ed1 authored by Colin Watson's avatar Colin Watson

pkgdetails.c: Only interpret percentages following whitespace, to cope with GNU…

pkgdetails.c: Only interpret percentages following whitespace, to cope with GNU wget outputting the local file name (which may contain "%" due to URL-encoding) after it finishes the download (LP: #1172101).
parent 400708b5
base-installer (1.142) UNRELEASED; urgency=medium
* pkgdetails.c: Only interpret percentages following whitespace, to cope
with GNU wget outputting the local file name (which may contain "%" due
to URL-encoding) after it finishes the download (LP: #1172101).
-- Colin Watson <cjwatson@debian.org> Fri, 07 Feb 2014 16:01:32 +0000
base-installer (1.141) unstable; urgency=low
[ Ian Campbell ]
......
......@@ -270,15 +270,19 @@ static void dopkgstanzas(char *pkgsfile, char **pkgs, int pkgc)
static int dotranslatewgetpercent(int low, int high, int end, char *str) {
int ch;
int val, lastval;
int allow_percentage;
/* print out anything that looks like a % on its own line, appropriately
* scaled */
lastval = val = 0;
allow_percentage = 0;
while ( (ch = getchar()) != EOF ) {
if (isdigit(ch)) {
if (isspace(ch)) {
allow_percentage = 1;
} else if (allow_percentage && isdigit(ch)) {
val *= 10; val += ch - '0';
} else if (ch == '%') {
} else if (allow_percentage && ch == '%') {
float f = (float) val / 100.0 * (high - low) + low;
if (str) {
printf("P: %d %d %s\n", (int) f, end, str);
......@@ -288,6 +292,7 @@ static int dotranslatewgetpercent(int low, int high, int end, char *str) {
lastval = val;
} else {
val = 0;
allow_percentage = 0;
}
}
return lastval == 100;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment