[vlc-devel] [PATCH 3/3] VLSub: Handle mkdir errors

Hugo Beauzée-Luyssen hugo at beauzee.fr
Wed Apr 11 15:31:46 CEST 2018


On Wed, Apr 11, 2018, at 2:02 PM, Rémi Denis-Courmont wrote:
> Le 11 avril 2018 13:59:50 GMT+03:00, "Hugo Beauzée-Luyssen" 
> <hugo at beauzee.fr> a écrit :
> >---
> > share/lua/extensions/VLSub.lua | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> >diff --git a/share/lua/extensions/VLSub.lua
> >b/share/lua/extensions/VLSub.lua
> >index 0306cc1d62..4539869839 100644
> >--- a/share/lua/extensions/VLSub.lua
> >+++ b/share/lua/extensions/VLSub.lua
> >@@ -667,7 +667,8 @@ function check_config()
> >   openSub.conf.dirPath = vlc.config.userdatadir()
> >   local subdirs = { "lua", "extensions", "userdata", "vlsub" }
> >   for _, dir in ipairs(subdirs) do
> >-    if not vlc.io.mkdir( openSub.conf.dirPath .. slash .. dir, "0700"
> >) then
> >+    local res, err = vlc.io.mkdir( openSub.conf.dirPath .. slash ..
> >dir, "0700" )
> >+    if res ~= 0 and err ~= vlc.errno.EEXIST then
> >vlc.msg.warn("Failed to create " .. openSub.conf.dirPath .. slash ..
> >dir )
> >       return false
> >     end
> >-- 
> >2.11.0
> >
> >_______________________________________________
> >vlc-devel mailing list
> >To unsubscribe or modify your subscription options:
> >https://mailman.videolan.org/listinfo/vlc-devel
> 
> The whole point of adding EEXIST is that we cannot take it for granted 
> that the directory is usable.

In which case the later folder creation will either fail (most likely with EACCES), or the file creation itself will fail.
I'm not sure what the alternative is

-- 
  Hugo Beauzée-Luyssen
  hugo at beauzee.fr


More information about the vlc-devel mailing list