[FFmpeg-devel,1/2] avutil/file: do not request PROT_WRITE in av_file_map

Submitted by Marton Balint on Sept. 6, 2018, 6:58 p.m.

Details

Message ID 20180906185837.24645-1-cus@passwd.hu
State New
Headers show

Commit Message

Marton Balint Sept. 6, 2018, 6:58 p.m.
The documentation states that av_file_map can only be used for reading and for
WIN32 we are already requesting a read only mapping.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavutil/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Sept. 6, 2018, 11:53 p.m.
On Thu, Sep 06, 2018 at 08:58:36PM +0200, Marton Balint wrote:
> The documentation states that av_file_map can only be used for reading and for
> WIN32 we are already requesting a read only mapping.

libavutil/tests/file.c disagrees and its unhappy with this patch

thx

[...]

Patch hide | download patch | download mbox

diff --git a/libavutil/file.c b/libavutil/file.c
index 24a86c3f35..2153e51379 100644
--- a/libavutil/file.c
+++ b/libavutil/file.c
@@ -86,7 +86,7 @@  int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
     *size = off_size;
 
 #if HAVE_MMAP
-    ptr = mmap(NULL, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
+    ptr = mmap(NULL, *size, PROT_READ, MAP_PRIVATE, fd, 0);
     if (ptr == MAP_FAILED) {
         err = AVERROR(errno);
         av_strerror(err, errbuf, sizeof(errbuf));