diff --git a/repos/libports/run/ldso.run b/repos/libports/run/ldso.run index f54fdae55e..81f1673440 100644 --- a/repos/libports/run/ldso.run +++ b/repos/libports/run/ldso.run @@ -77,7 +77,7 @@ compare_output_to { [init -> test-ldso] lib_1_local_3 12345676 [init -> test-ldso] lib_1_pod_1 8070604d [init -> test-ldso] Libc::read: -[init -> test-ldso] Error: no plugin found for read(0) +[init -> test-ldso] Error: no plugin found for read(3) [init -> test-ldso] Libc::abs(-10): 10 [init -> test-ldso] [init -> test-ldso] Catch exceptions in program diff --git a/repos/libports/src/lib/libc/vfs_plugin.h b/repos/libports/src/lib/libc/vfs_plugin.h index 22ba7984d3..c844e0e7d2 100644 --- a/repos/libports/src/lib/libc/vfs_plugin.h +++ b/repos/libports/src/lib/libc/vfs_plugin.h @@ -70,7 +70,10 @@ class Libc::Vfs_plugin : public Libc::Plugin if (fd->fd_path) { Genode::warning("may leak former FD path memory"); } fd->fd_path = strdup(path.string()); - } catch (Xml_node::Nonexistent_attribute) { } + } catch (Xml_node::Nonexistent_attribute) { + /* fill the stdio number with a EBADF */ + Libc::file_descriptor_allocator()->alloc(nullptr, nullptr, libc_fd); + } } void _vfs_sync(Vfs::Vfs_handle *vfs_handle) diff --git a/repos/libports/src/test/ldso/main.cc b/repos/libports/src/test/ldso/main.cc index 50b67b6eef..ae7b6df168 100644 --- a/repos/libports/src/test/ldso/main.cc +++ b/repos/libports/src/test/ldso/main.cc @@ -211,7 +211,7 @@ void Libc::Component::construct(Libc::Env &env) lib_1_local_3()->lib_1_local_3(); printf("lib_1_pod_1 %x\n", --pod_1); - int fd = 0; + int fd = STDERR_FILENO + 1; char buf[2]; printf("Libc::read:\n"); Libc::read(fd, buf, 2);