[vlc-devel] [PATCH] win32: filesystem: transform UNIX permissions into Windows flags for _wopen()

Steve Lhomme robux4 at videolabs.io
Tue Oct 17 16:23:14 CEST 2017


---
replaces https://patches.videolan.org/patch/18248/
- do not handle the executable bit as it doesn't make sense on Windows
---
 src/win32/filesystem.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/win32/filesystem.c b/src/win32/filesystem.c
index 29a7a3fc4d..8d56cc859a 100644
--- a/src/win32/filesystem.c
+++ b/src/win32/filesystem.c
@@ -81,7 +81,13 @@ int vlc_open (const char *filename, int flags, ...)
 
     va_start (ap, flags);
     if (flags & O_CREAT)
-        mode = va_arg (ap, int);
+    {
+        int unixmode = va_arg(ap, int);
+        if (unixmode & 0444)
+            mode |= _S_IREAD;
+        if (unixmode & 0222)
+            mode |= _S_IWRITE;
+    }
     va_end (ap);
 
     /*
-- 
2.14.2



More information about the vlc-devel mailing list