diff options
author | Al Poole <netstar@gmail.com> | 2017-07-07 11:19:31 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2017-07-07 13:22:53 +0900 |
commit | 9aeaef55c4f6791feaddbd6be9c6dbc6e3e0c087 (patch) | |
tree | d857d906e1ec63f87a7b89c555fba12b25e58cb1 /src/lib/eina/eina_file.c | |
parent | 242127a96be0eb78791f48fae7c44f0f16248add (diff) |
eina_file: fix unmap of unmapped region when Eina_File has copied data and not a map;
Summary:
This was causing problems on non-Linux architectures as eina_file_real_close unmapped not mapped data. Added a "copied" flag to Eina_File which is set on eina_file_virtualize (on copied data), and tested for when eina_file_real_close does the unmap. I'm surprised Linux allowed this. Certainly all of the BSDs crashed with the previous behaviour.
@fix T5479
Test Plan: Example inlcude Rage and Enlightenment Thumb on BSD systems which use eina_file_virtualize with emotion to obtain album artwork.
Reviewers: raster, cedric, jpeg
Reviewed By: jpeg
Maniphest Tasks: T5479
Differential Revision: https://phab.enlightenment.org/D5006
Diffstat (limited to 'src/lib/eina/eina_file.c')
-rw-r--r-- | src/lib/eina/eina_file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/eina/eina_file.c b/src/lib/eina/eina_file.c index 4a0c782..2fae7b7 100644 --- a/src/lib/eina/eina_file.c +++ b/src/lib/eina/eina_file.c | |||
@@ -295,7 +295,7 @@ eina_file_real_close(Eina_File *file) | |||
295 | free(map); | 295 | free(map); |
296 | } | 296 | } |
297 | 297 | ||
298 | if (file->global_map != MAP_FAILED) | 298 | if (!file->copied && file->global_map != MAP_FAILED) |
299 | munmap(file->global_map, file->length); | 299 | munmap(file->global_map, file->length); |
300 | 300 | ||
301 | if (file->fd != -1) close(file->fd); | 301 | if (file->fd != -1) close(file->fd); |