summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar sean <seanlkml@sympatico.ca>2006-05-06 14:14:02 -0400
committerLibravatar Junio C Hamano <junkio@cox.net>2006-05-06 14:03:09 -0700
commit6f81bf16a91c4db5a02b81cbade89e73ca4d49b4 (patch)
tree82c9e91117510a04c8b760bf4ee2cc6eeacf5f29
parentupdate-index: plug memory leak from prefix_path() (diff)
downloadtgif-6f81bf16a91c4db5a02b81cbade89e73ca4d49b4.tar.xz
Another config file parsing fix.
If the variable we need to store should go into a section that currently only has a single variable (not matching the one we're trying to insert), we will already be into the next section before we notice we've bypassed the correct location to insert the variable. To handle this case we store the current location as soon as we find a variable matching the section of our new variable. This breakage was brought up by Linus. Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--config.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/config.c b/config.c
index 87fb22041e..41066e4f4e 100644
--- a/config.c
+++ b/config.c
@@ -336,8 +336,10 @@ static int store_aux(const char* key, const char* value)
store.state = KEY_SEEN;
store.seen++;
} else if (strrchr(key, '.') - key == store.baselen &&
- !strncmp(key, store.key, store.baselen))
+ !strncmp(key, store.key, store.baselen)) {
store.state = SECTION_SEEN;
+ store.offset[store.seen] = ftell(config_file);
+ }
}
return 0;
}