Commit 34aef4ad authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

mmap: Correct [cbc1122a]

I accidently change the probe, not the actual mmap() usage.
parent 8dcf947d
...@@ -136,12 +136,7 @@ static int Open (vlc_object_t *p_this) ...@@ -136,12 +136,7 @@ static int Open (vlc_object_t *p_this)
/* Autodetect mmap() support */ /* Autodetect mmap() support */
if (st.st_size > 0) if (st.st_size > 0)
{ {
int flags = MAP_PRIVATE; void *addr = mmap (NULL, 1, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
#if defined(MAP_NOCACHE)
flags |= MAP_NOCACHE;
#endif
void *addr = mmap (NULL, 1, PROT_READ|PROT_WRITE, flags, fd, 0);
if (addr != MAP_FAILED) if (addr != MAP_FAILED)
munmap (addr, 1); munmap (addr, 1);
else else
...@@ -225,8 +220,11 @@ static block_t *Block (access_t *p_access) ...@@ -225,8 +220,11 @@ static block_t *Block (access_t *p_access)
/* NOTE: We use PROT_WRITE and MAP_PRIVATE so that the block can be /* NOTE: We use PROT_WRITE and MAP_PRIVATE so that the block can be
* modified down the chain, without messing up with the underlying * modified down the chain, without messing up with the underlying
* original file. This does NOT need open write permission. */ * original file. This does NOT need open write permission. */
void *addr = mmap (NULL, length, PROT_READ|PROT_WRITE, MAP_PRIVATE, void *addr = mmap (NULL, length, PROT_READ|PROT_WRITE, MAP_PRIVATE
p_sys->fd, outer_offset); #ifdef MAP_NO_CACHE
| MAP_NOCACHE
#endif
, p_sys->fd, outer_offset);
if (addr == MAP_FAILED) if (addr == MAP_FAILED)
{ {
msg_Err (p_access, "memory mapping failed (%m)"); msg_Err (p_access, "memory mapping failed (%m)");
......
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