aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2013-11-28 23:31:31 +0100
committerDaniel Stenberg <daniel@haxx.se>2013-11-28 23:31:31 +0100
commit0dd6522036daa8468c55c4a0c6b70d1c510e879a (patch)
tree254abcdca79984c8440d93775b22e96df94c19bb
parent889cb9c9827fd641187f3926b65a47eb72ed93ac (diff)
globbing: curl glob counter mismatch with {} list use
The "fixed string" function wrongly bumped the "urlnum" counter which made curl output the total number of URLs wrong when using {one,two,three} lists in globs. Reported-by: Michael-O Bug: http://curl.haxx.se/bug/view.cgi?id=1305
-rw-r--r--src/tool_urlglob.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/tool_urlglob.c b/src/tool_urlglob.c
index aa87e5a37..ec5014b97 100644
--- a/src/tool_urlglob.c
+++ b/src/tool_urlglob.c
@@ -40,8 +40,7 @@ typedef enum {
void glob_cleanup(URLGlob* glob);
-static GlobCode glob_fixed(URLGlob *glob, unsigned long *amount,
- char *fixed, size_t len)
+static GlobCode glob_fixed(URLGlob *glob, char *fixed, size_t len)
{
URLPattern *pat = &glob->pattern[glob->size];
pat->type = UPTSet;
@@ -49,8 +48,6 @@ static GlobCode glob_fixed(URLGlob *glob, unsigned long *amount,
pat->content.Set.ptr_s = 0;
pat->globindex = -1;
- (*amount)++;
-
pat->content.Set.elements = malloc(sizeof(char*));
if(!pat->content.Set.elements)
@@ -314,6 +311,8 @@ static GlobCode glob_parse(URLGlob *glob, char *pattern,
GlobCode res = GLOB_OK;
int globindex = 0; /* count "actual" globs */
+ *amount = 1;
+
while(*pattern && !res) {
char *buf = glob->glob_buffer;
int sublen = 0;
@@ -337,12 +336,9 @@ static GlobCode glob_parse(URLGlob *glob, char *pattern,
if(sublen) {
/* we got a literal string, add it as a single-item list */
*buf = '\0';
- res = glob_fixed(glob, amount, glob->glob_buffer, sublen);
+ res = glob_fixed(glob, glob->glob_buffer, sublen);
}
else {
- if(!*amount)
- *amount = 1;
-
switch (*pattern) {
case '\0': /* done */
break;