@matheusbsbs / matheus-bagliano / commits / bdf0ef0824
Fork 0

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>

sean committed May 6, 2006 at 14:14 UTC bdf0ef0824ecca427ec04ac047ffe4aaf73ace5a
1 file changed +3 -1
config.c
+3 -1
@@ -336,8 +336,10 @@ static int store_aux(const char* key, const char* value)
336 store.state = KEY_SEEN;
337 store.seen++;
338 } else if (strrchr(key, '.') - key == store.baselen &&
339 - !strncmp(key, store.key, store.baselen))
339 + !strncmp(key, store.key, store.baselen)) {
340 store.state = SECTION_SEEN;
341 + store.offset[store.seen] = ftell(config_file);
342 + }
343 }
344 return 0;
345 }