aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortingyuan <thuang@mozilla.com>2013-04-15 14:14:45 +0800
committerAlon Zakai <alonzakai@gmail.com>2013-05-21 17:09:58 -0700
commit0cc707a60b3aaa18c4caaf366e8edb420eb09ad3 (patch)
tree7b6d10b8927ca9b2da61caa4b6445cf4ef2633e7
parent36b4d29ab3e5b1dbf1e44aacff8e1c4178526f05 (diff)
Assert that MAP_SHARED is only specified with files backed by HEAP.
-rw-r--r--src/library.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/library.js b/src/library.js
index 6972a89e..d0097c19 100644
--- a/src/library.js
+++ b/src/library.js
@@ -3740,8 +3740,10 @@ LibraryManager.library = {
var info = FS.streams[stream];
if (!info) return -1;
var contents = info.object.contents;
- // Only make a new copy when the file is not in HEAP or MAP_PRIVATE is specified.
- if (contents.buffer === HEAPU8.buffer && flags & MAP_PRIVATE == 0) {
+ // Only make a new copy when MAP_PRIVATE is specified.
+ if (flags & MAP_PRIVATE == 0) {
+ // We can't emulate MAP_SHARED when the file is not backed by HEAP.
+ assert(contents.buffer === HEAPU8.buffer);
ptr = contents.byteOffset;
allocated = false;
} else {