git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Another config file parsing fix.

From
sean <seanlkml@sympatico.ca>
Date
May 6, 2006, 18:14 UTC
Message-ID
<BAYC1-PASMTP050DC939D9D702CA1B3208AEAA0@CEZ.ICE>

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.

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
---
 config.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
1ba487db7393d773a2a4b7c404ba1b807272eb7d
diff --git a/config.c b/config.c
index 87fb220..41066e4 100644
--- a/config.c
+++ b/config.c
@@ -336,8 +336,10 @@ static int store_aux(const char* key, co
 			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;
 }
-- 
1.3.2.g6e99a-dirty
Message 1 of 1 in “Another config file parsing fix.”
  1. Another config file parsing fix.sean, May 6, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.