posix: improve config error diagnostics

This commit is contained in:
Norman Feske 2019-08-21 18:23:36 +02:00 committed by Christian Helmuth
parent 3c6fe6e741
commit 817ff6ca68

View File

@ -82,6 +82,13 @@ static void construct_component(Libc::Env &env)
/* insert an environment variable */ /* insert an environment variable */
if (node.has_type("env")) try { if (node.has_type("env")) try {
auto check_attr = [] (Xml_node node, auto key) {
if (!node.has_attribute(key))
Genode::warning("<env> node lacks '", key, "' attribute"); };
check_attr(node, "key");
check_attr(node, "value");
Xml_attribute const key = node.attribute("key"); Xml_attribute const key = node.attribute("key");
Xml_attribute const value = node.attribute("value"); Xml_attribute const value = node.attribute("value");
@ -122,7 +129,9 @@ static void construct_component(Libc::Env &env)
++env_i; ++env_i;
} catch (Xml_node::Nonexistent_sub_node) { } }
catch (Xml_node::Nonexistent_sub_node) { }
catch (Xml_node::Nonexistent_attribute) { }
}); });
envp[env_i] = NULL; envp[env_i] = NULL;