[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] make parse_line_from_file fail rather than warn for malform...



Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/common

Modified Files:
	util.c 
Log Message:
make parse_line_from_file fail rather than warn for malformed lines


Index: util.c
===================================================================
RCS file: /home/or/cvsroot/src/common/util.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- util.c	28 Feb 2004 23:21:29 -0000	1.54
+++ util.c	2 Mar 2004 04:59:52 -0000	1.55
@@ -621,8 +621,9 @@
 }
 
 /* read lines from f (no more than maxlen-1 bytes each) until we
- * get one with a well-formed "key value".
- * point *key to the first word in line, point *value to the second.
+ * get a non-whitespace line. If it isn't of the form "key value"
+ * (value can have spaces), return -1.
+ * Point *key to the first word in line, point *value * to the second.
  * Put a \0 at the end of key, remove everything at the end of value
  * that is whitespace or comment.
  * Return 1 if success, 0 if no more lines, -1 if error.
@@ -661,8 +662,8 @@
 
   if(!*end || !*value) { /* only a key on this line. no value. */
     *end = 0;
-    log_fn(LOG_WARN,"Line has keyword '%s' but no value. Skipping.",key);
-    goto try_next_line;
+    log_fn(LOG_WARN,"Line has keyword '%s' but no value. Failing.",key);
+    return -1;
   }
   *end = 0; /* null it out */