Commit d2eda017 authored by Lucian Grijincu's avatar Lucian Grijincu Committed by Viswanath Sivakumar

folly: MemoryMapping: respect writable when opening the file

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
parent 69befbf8
......@@ -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)
......
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