mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 08:25:38 +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("/"))
|
||||
env.config([&] (Xml_node const &top) {
|
||||
Xml_node const node = top.sub_node("libc");
|
||||
|
||||
try {
|
||||
Genode::String<Vfs::MAX_PATH_LEN> path;
|
||||
node.attribute("cwd").value(&path);
|
||||
chdir(path.string());
|
||||
} catch (Xml_node::Nonexistent_attribute) { }
|
||||
Xml_node const node = top.sub_node("libc");
|
||||
|
||||
_open_stdio(node, "stdin", 0, O_RDONLY);
|
||||
_open_stdio(node, "stdout", 1, O_WRONLY);
|
||||
_open_stdio(node, "stderr", 2, O_WRONLY);
|
||||
try {
|
||||
Genode::String<Vfs::MAX_PATH_LEN> path;
|
||||
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