From a9e8e40c1a1ac935b7574f747e2b8e6d67e96f7f Mon Sep 17 00:00:00 2001
From: Per Hedbor <ph@opera.com>
Date: Wed, 23 Mar 2011 08:19:26 +0100
Subject: [PATCH] System.Memory.mmap: If the file cannot be opened in
 read/write mode, try read only.

---
 src/modules/system/memory.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/modules/system/memory.c b/src/modules/system/memory.c
index 415f278aef..955b9f736c 100644
--- a/src/modules/system/memory.c
+++ b/src/modules/system/memory.c
@@ -341,6 +341,9 @@ static void memory__mmap(INT32 args,int complain,int private)
       
       THREADS_ALLOW();
       fd = fd_open(filename,fd_RDWR,0);
+      if( fd < 0 )
+          fd = fd_open(filename,fd_RDONLY,0);
+
       if (fd>=0) osize=file_size(fd);
       THREADS_DISALLOW();
 
-- 
GitLab