[vlc-devel] [RFC PATCH] lua: io: Don't swallow EEXIST errors
    Hugo Beauzée-Luyssen 
    hugo at beauzee.fr
       
    Tue Apr 10 18:28:52 CEST 2018
    
    
  
---
 modules/lua/libs/io.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/modules/lua/libs/io.c b/modules/lua/libs/io.c
index acb94c491d..e782db98c4 100644
--- a/modules/lua/libs/io.c
+++ b/modules/lua/libs/io.c
@@ -239,8 +239,11 @@ static int vlclua_mkdir( lua_State *L )
     if ( !psz_dir || !psz_mode )
         return vlclua_error( L );
     int i_res = vlc_mkdir( psz_dir, strtoul( psz_mode, NULL, 0 ) );
-    lua_pushboolean( L, i_res == 0 || errno == EEXIST );
-    return 1;
+    bool b_created = i_res == 0;
+    bool b_existed = b_created == false && errno == EEXIST;
+    lua_pushboolean( L, b_created );
+    lua_pushboolean( L, b_existed );
+    return 2;
 }
 
 static const luaL_Reg vlclua_io_reg[] = {
-- 
2.11.0
    
    
More information about the vlc-devel
mailing list