getconfig.c patch

Heath Kehoe heath.kehoe at intermec.com
Mon Sep 4 18:53:41 UTC 2000



Fix ReadInnConf() to remove trailing whitespace from the config value,
and fix the boolval setting of groupbaseexpiry to be consistent with
the other boolval parameters.

-heath

Index: lib/getconfig.c
===================================================================
RCS file: /home/heath/inn/repository/inn/lib/getconfig.c,v
retrieving revision 1.71.2.3
diff -u -r1.71.2.3 getconfig.c
--- lib/getconfig.c	2000/07/17 06:46:14	1.71.2.3
+++ lib/getconfig.c	2000/09/04 18:47:22
@@ -409,7 +409,7 @@
 int ReadInnConf()
 {
     FILE	        *F;
-    char	        *p;
+    char	        *p, *q;
     int			boolval;
     BOOL		bit;
 
@@ -443,6 +443,12 @@
 	    for ( ; ISWHITE(*p); p++)
 		continue;
 	    if (!*p) continue;
+
+            /* trim trailing whitespace */
+	    q = &p[strlen(p)-1];
+	    while (q>p && ISWHITE(*q))
+		*q-- = '\0';
+
 	    boolval = -1;
 	    if (caseEQ(p, "on") || caseEQ(p, "true") || caseEQ(p, "yes"))
 		boolval = TRUE;
@@ -963,7 +969,7 @@
 	    } else 
 	    if (EQ(ConfigBuff,_CONF_GROUPBASEEXPIRY)) {
 		TEST_CONFIG(CONF_VAR_GROUPBASEEXPIRY, bit);
-		if (!bit) innconf->groupbaseexpiry = boolval;
+		if (!bit && boolval != -1) innconf->groupbaseexpiry = boolval;
 		SET_CONFIG(CONF_VAR_GROUPBASEEXPIRY);
 	    } else 
 	    if (EQ(ConfigBuff,_CONF_WIPCHECK)) {



More information about the inn-patches mailing list