As the filename is now a stringshare, also make sure virtual
files use stringshares for the filename! Also when unmapping
we still need to test whether it is copied or not as unmap
will break on less tolerant architectures.
@fix T6449
if (file->fd != -1)
{
- if (file->global_map != MAP_FAILED)
+ if (!file->copied && file->global_map != MAP_FAILED)
munmap(file->global_map, file->length);
close(file->fd);
}
EINA_MAGIC_SET(file, EINA_FILE_MAGIC);
file->filename = (char *)(file + 1);
if (virtual_name)
- strcpy((char *)file->filename, virtual_name);
+ file->filename = eina_stringshare_add(virtual_name);
else
- sprintf((char *)file->filename, tmpname, ti);
+ file->filename = eina_stringshare_printf(tmpname, ti);
eina_lock_recursive_new(&file->lock);
file->mtime = ti / 1000;