mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-07 11:50:24 +00:00
parent
fe1ee05186
commit
0e01729d77
@ -287,6 +287,12 @@ Libc::File_descriptor *Libc::Vfs_plugin::open_from_kernel(const char *path, int
|
|||||||
File_descriptor *fd =
|
File_descriptor *fd =
|
||||||
file_descriptor_allocator()->alloc(this, vfs_context(handle), libc_fd);
|
file_descriptor_allocator()->alloc(this, vfs_context(handle), libc_fd);
|
||||||
|
|
||||||
|
if (!fd) {
|
||||||
|
handle->close();
|
||||||
|
errno = EMFILE;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
handle->handler(&_response_handler);
|
handle->handler(&_response_handler);
|
||||||
fd->flags = flags & O_ACCMODE;
|
fd->flags = flags & O_ACCMODE;
|
||||||
|
|
||||||
@ -360,6 +366,12 @@ Libc::File_descriptor *Libc::Vfs_plugin::open_from_kernel(const char *path, int
|
|||||||
File_descriptor *fd =
|
File_descriptor *fd =
|
||||||
file_descriptor_allocator()->alloc(this, vfs_context(handle), libc_fd);
|
file_descriptor_allocator()->alloc(this, vfs_context(handle), libc_fd);
|
||||||
|
|
||||||
|
if (!fd) {
|
||||||
|
handle->close();
|
||||||
|
errno = EMFILE;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
handle->handler(&_response_handler);
|
handle->handler(&_response_handler);
|
||||||
fd->flags = flags & (O_ACCMODE|O_NONBLOCK|O_APPEND);
|
fd->flags = flags & (O_ACCMODE|O_NONBLOCK|O_APPEND);
|
||||||
|
|
||||||
@ -406,8 +418,6 @@ Libc::File_descriptor *Libc::Vfs_plugin::open(char const *path, int flags)
|
|||||||
|
|
||||||
fd = file_descriptor_allocator()->alloc(this, vfs_context(handle), Libc::ANY_FD);
|
fd = file_descriptor_allocator()->alloc(this, vfs_context(handle), Libc::ANY_FD);
|
||||||
|
|
||||||
/* FIXME error cleanup code leaks resources! */
|
|
||||||
|
|
||||||
if (!fd) {
|
if (!fd) {
|
||||||
handle->close();
|
handle->close();
|
||||||
result_errno = EMFILE;
|
result_errno = EMFILE;
|
||||||
@ -487,8 +497,6 @@ Libc::File_descriptor *Libc::Vfs_plugin::open(char const *path, int flags)
|
|||||||
|
|
||||||
fd = file_descriptor_allocator()->alloc(this, vfs_context(handle), Libc::ANY_FD);
|
fd = file_descriptor_allocator()->alloc(this, vfs_context(handle), Libc::ANY_FD);
|
||||||
|
|
||||||
/* FIXME error cleanup code leaks resources! */
|
|
||||||
|
|
||||||
if (!fd) {
|
if (!fd) {
|
||||||
handle->close();
|
handle->close();
|
||||||
result_errno = EMFILE;
|
result_errno = EMFILE;
|
||||||
@ -654,6 +662,12 @@ Libc::File_descriptor *Libc::Vfs_plugin::dup(File_descriptor *fd)
|
|||||||
File_descriptor * const new_fd =
|
File_descriptor * const new_fd =
|
||||||
file_descriptor_allocator()->alloc(this, vfs_context(handle));
|
file_descriptor_allocator()->alloc(this, vfs_context(handle));
|
||||||
|
|
||||||
|
if (!new_fd) {
|
||||||
|
handle->close();
|
||||||
|
result_errno = EMFILE;
|
||||||
|
return Fn::COMPLETE;
|
||||||
|
}
|
||||||
|
|
||||||
new_fd->flags = fd->flags;
|
new_fd->flags = fd->flags;
|
||||||
new_fd->path(fd->fd_path);
|
new_fd->path(fd->fd_path);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user