mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-28 06:49:47 +00:00
libc: do not open stdio descriptors unless configured to do so
Fix #2396
This commit is contained in:
parent
24a9537a27
commit
01e8f7ea3d
@ -82,17 +82,19 @@ class Libc::Vfs_plugin : public Libc::Plugin
|
|||||||
|
|
||||||
if (_root_dir.num_dirent("/"))
|
if (_root_dir.num_dirent("/"))
|
||||||
env.config([&] (Xml_node const &top) {
|
env.config([&] (Xml_node const &top) {
|
||||||
Xml_node const node = top.sub_node("libc");
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Genode::String<Vfs::MAX_PATH_LEN> path;
|
Xml_node const node = top.sub_node("libc");
|
||||||
node.attribute("cwd").value(&path);
|
|
||||||
chdir(path.string());
|
|
||||||
} catch (Xml_node::Nonexistent_attribute) { }
|
|
||||||
|
|
||||||
_open_stdio(node, "stdin", 0, O_RDONLY);
|
try {
|
||||||
_open_stdio(node, "stdout", 1, O_WRONLY);
|
Genode::String<Vfs::MAX_PATH_LEN> path;
|
||||||
_open_stdio(node, "stderr", 2, O_WRONLY);
|
node.attribute("cwd").value(&path);
|
||||||
|
chdir(path.string());
|
||||||
|
} catch (Xml_node::Nonexistent_attribute) { }
|
||||||
|
|
||||||
|
_open_stdio(node, "stdin", 0, O_RDONLY);
|
||||||
|
_open_stdio(node, "stdout", 1, O_WRONLY);
|
||||||
|
_open_stdio(node, "stderr", 2, O_WRONLY);
|
||||||
|
} catch (Xml_node::Nonexistent_sub_node) { }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user