projects
/
folly.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
69befbf
)
folly: MemoryMapping: respect writable when opening the file
author
Lucian Grijincu
<lucian@fb.com>
Wed, 8 Apr 2015 18:14:17 +0000
(11:14 -0700)
committer
Viswanath Sivakumar
<viswanath@fb.com>
Fri, 10 Apr 2015 03:34:36 +0000
(20:34 -0700)
Summary: the file needs to be opened with write-permissions before it can be mmaped with PROT_WRITE.
Test Plan: n/a
Reviewed By: philipp@fb.com
Subscribers: folly-diffs@, yfeldblum, chalfant
FB internal diff:
D1974895
Signature: t1:
1974895
:
1428451664
:
1106019abf02b9de659ce0d305e3d788ae7d60bc
folly/MemoryMapping.cpp
patch
|
blob
|
history
diff --git
a/folly/MemoryMapping.cpp
b/folly/MemoryMapping.cpp
index 3750ef618405483d98ec0438f23a43449e48e51f..43889257b5aa6c307a4cc9785264f4d1ab95e0f6 100644
(file)
--- a/
folly/MemoryMapping.cpp
+++ b/
folly/MemoryMapping.cpp
@@
-52,7
+52,10
@@
MemoryMapping::MemoryMapping(File file, off_t offset, off_t length,
MemoryMapping::MemoryMapping(const char* name, off_t offset, off_t length,
Options options)
- : MemoryMapping(File(name), offset, length, options) { }
+ : MemoryMapping(File(name, options.writable ? O_RDWR : O_RDONLY),
+ offset,
+ length,
+ options) { }
MemoryMapping::MemoryMapping(int fd, off_t offset, off_t length,
Options options)