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

Steve Lhomme robux4 at gmail.com
Tue Sep 26 15:48:49 CEST 2017


On Tue, Sep 26, 2017 at 3:43 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le 26 septembre 2017 13:39:49 GMT+03:00, Steve Lhomme <robux4 at videolabs.io> a écrit :
>>---
>> src/win32/filesystem.c | 10 +++++++++-
>> 1 file changed, 9 insertions(+), 1 deletion(-)
>>
>>diff --git a/src/win32/filesystem.c b/src/win32/filesystem.c
>>index 29a7a3fc4d..b3a5b6b6ea 100644
>>--- a/src/win32/filesystem.c
>>+++ b/src/win32/filesystem.c
>>@@ -81,7 +81,15 @@ 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;
>>+        if (unixmode & 0111)
>>+            mode |= _S_IEXEC;
>>+    }
>>     va_end (ap);
>>
>>     /*
>>--
>>2.12.1
>>
>>_______________________________________________
>>vlc-devel mailing list
>>To unsubscribe or modify your subscription options:
>>https://mailman.videolan.org/listinfo/vlc-devel
>
> Aren't read and exec permissions no-ops on Windows? This looks overkill.

exec possibly. Read probably not depending on the access rights that
are possible on NTFS.

> And I'd only check S_IWUSR, not all three write bits...

We can't differentiate between a particular mode at this level, so
whichever fits the right we want should enable the flag.

> --
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list