1.1 --- a/libfsclient/lib/src/file.cc Wed Mar 02 22:27:19 2022 +0100
1.2 +++ b/libfsclient/lib/src/file.cc Wed Mar 02 22:27:28 2022 +0100
1.3 @@ -21,6 +21,7 @@
1.4
1.5 #include <ipc/cap_alloc.h>
1.6 #include <ipc/mem_ipc.h>
1.7 +#include <systypes/stat.h>
1.8
1.9 #include <string.h>
1.10
1.11 @@ -96,14 +97,15 @@
1.12 void file_close(file_t *file)
1.13 {
1.14 if (l4_is_valid_cap(file->ref))
1.15 + {
1.16 ipc_cap_free_um(file->ref);
1.17
1.18 - /* Only unsubscribe after actually closing the file and sending any
1.19 - notifications. This depends on a valid reference, so it is also tested
1.20 - here. */
1.21 + /* Only unsubscribe after actually closing the file and sending any
1.22 + notifications. This depends on a valid reference, so it is also tested
1.23 + here. */
1.24
1.25 - if (l4_is_valid_cap(file->ref))
1.26 notifier_get_task_notifier()->unsubscribe(file);
1.27 + }
1.28
1.29 if (file->memory != NULL)
1.30 ipc_detach_dataspace(file->memory);
1.31 @@ -282,7 +284,10 @@
1.32 if (err)
1.33 return err;
1.34
1.35 - memcpy(st, context->memory, sizeof(struct stat));
1.36 + /* Copy the stat structure manually in case of any divergence. */
1.37 +
1.38 + systypes_copy_from_sys_stat(st, (sys_stat_t *) context->memory);
1.39 +
1.40 return L4_EOK;
1.41 }
1.42