- handle = (MmapHandle *)open_file_map (path, -1, mode, capacity, access, options, error);
- if (handle) {
- handle->name = g_strdup (c_mapName);
- g_hash_table_insert (named_regions, handle->name, handle);
+ char *c_path = mono_string_to_utf8_checked (path, &error);
+ if (is_ok (&error)) {
+ handle = (MmapHandle *)open_file_map (c_path, -1, mode, capacity, access, options, ioerror);
+ if (handle) {
+ handle->name = g_strdup (c_mapName);
+ g_hash_table_insert (named_regions, handle->name, handle);
+ }
+ } else {
+ handle = NULL;