Commit df7873bd authored by Al Poole's avatar Al Poole Committed by Carsten Haitzler (Rasterman)

eina_file: make sure we use a stringshare when virtualized.

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
parent 18a941bb
......@@ -297,7 +297,7 @@ eina_file_real_close(Eina_File *file)
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);
}
......
......@@ -422,9 +422,9 @@ eina_file_virtualize(const char *virtual_name, const void *data, unsigned long l
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment