Re: [ULOGD PATCH 3/5] Enable reading of hex or dec integer in config file.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Eric Leblond wrote:
The config file parsing was not able to parse integer given in hex notation.
This patch modify the parsing of configfile to be able to use different
integers notation.

Signed-off-by: Eric Leblond <eric@xxxxxx>
---
 src/conffile.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/conffile.c b/src/conffile.c
index b74da68..075b867 100644
--- a/src/conffile.c
+++ b/src/conffile.c
@@ -115,6 +115,7 @@ int config_parse_file(const char *section, struct config_keyset *kset)
 	int i;
 	char linebuf[LINE_LEN+1];
 	char *line = linebuf;
+	char *end;
pr_debug("%s: section='%s' file='%s'\n", __func__, section, fname); @@ -192,7 +193,7 @@ int config_parse_file(const char *section, struct config_keyset *kset)
 					}
 					break;
 				case CONFIG_TYPE_INT:
-					ce->u.value = atoi(args);
+					ce->u.value = strtoul(args, &end, 0);


Not that it matters much, but you can also pass a NULL
pointer to strtoul in case you're not interested in the
end (no need to resend of course).

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux