Rather than a generic "Error parsing line" for an unknown token within a section, issue a more helpful error message, i.e. [data] foo=1 would yield: Invalid token in section [data] at line /etc/xfs/mkfs/default:2 : foo Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx> --- I may make one more pass over all these error messages because they seem a little hard to parse, but for now this matches the others, in general. i.e. i'd rather have: Invalid section "[splat]" at /etc/xfs/mkfs/default:1 ... Invalid token "foo" in section [data] at /etc/xfs/mkfs/default:2 or something like that, but I'll try to make any textual changes file-wide if they seem warranted. diff --git a/mkfs/config.c b/mkfs/config.c index 9954691..70d752c 100644 --- a/mkfs/config.c +++ b/mkfs/config.c @@ -466,9 +466,6 @@ _("No section specified yet on line %s:%zu : %s\n"), */ snprintf(p, len, "%s=%lu", tag, value); - /* Not needed anymore */ - free(tag); - /* * We only use getsubopt() to validate the possible * subopt, we already parsed the value and its already @@ -476,6 +473,16 @@ _("No section specified yet on line %s:%zu : %s\n"), */ subopt = getsubopt(&p, (char **) confopt->subopts, &ignore_value); + if (subopt == -1) { + errno = EINVAL; + fprintf(stderr, +_("Invalid token in section [%s] at line %s:%zu : %s\n"), + confopt->name, config_file, lineno, tag); + goto out_free_tag; + } + + /* Not needed anymore */ + free(tag); ret = confopt->parser(dft, subopt, value); if (ret) { -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html