Changeset: d7d24f76b0d5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d7d24f76b0d5
Modified Files:
tools/merovingian/utils/utils.c
Branch: Jul2017
Log Message:
Fix a bug in the reading of the properties file
For each line of the form
key_i=value_i
in the properties file we call the function setConfValForKey. If key_i is not in
list of properties, then setConfValForKey will return an error that the key is
not recognized and in that case we need to add the property to the list.
diffs (46 lines):
diff --git a/tools/merovingian/utils/utils.c b/tools/merovingian/utils/utils.c
--- a/tools/merovingian/utils/utils.c
+++ b/tools/merovingian/utils/utils.c
@@ -85,7 +85,13 @@ readConfFileFull(confkeyval *list, FILE
/* iterate until the end of the array */
while (list->key != NULL) {
- /* If we already have PROPLENGTH entries, */
+ /* If we already have PROPLENGTH entries, we cannot add any
more. Do
+ * read the file because it might specify a different value for
an
+ * existing property.
+ *
+ * TODO: This is an arbitrary limitation and should either be
justified
+ * sufficiently or removed.
+ */
if (cnt >= PROPLENGTH - 1) {
break;
}
@@ -101,11 +107,14 @@ readConfFileFull(confkeyval *list, FILE
/* strip trailing newline */
val = strtok(val, "\n");
if ((err = setConfValForKey(t, key, val)) != NULL) {
- if (strstr(err, "is not recognized") == NULL) {
- /* If we already have more than
PROPLENGTH
- * entries, ignore every ad hoc property
+ if (strstr(err, "is not recognized") != NULL) {
+ /* If we already have PROPLENGTH
entries in the list, ignore
+ * every ad hoc property, but continue
reading the file
+ * because a different value might be
specified later in the
+ * file for one of the properties we
have already in the list.
*/
if (cnt >= PROPLENGTH - 1) {
+ free(err);
continue;
}
list->key = strdup(key);
@@ -279,6 +288,9 @@ setConfValForKey(confkeyval *list, const
}
list++;
}
+ /* XXX: Do NOT change this error message or readConfFileFull will stop
+ * working as expected.
+ */
snprintf(buf, sizeof(buf), "key '%s' is not recognized, internal
error", key);
return(strdup(buf));
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list