[vlc-commits] lua: io: Don't swallow EEXIST errors

Hugo Beauzée-Luyssen git at videolan.org
Thu Apr 12 11:52:07 CEST 2018


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Apr 10 18:27:48 2018 +0200| [4b4b2df3dff27cc16156f9b5070853f0b9d966fb] | committer: Hugo Beauzée-Luyssen

lua: io: Don't swallow EEXIST errors

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4b4b2df3dff27cc16156f9b5070853f0b9d966fb
---

 modules/lua/libs/io.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/lua/libs/io.c b/modules/lua/libs/io.c
index acb94c491d..d92ae445fd 100644
--- a/modules/lua/libs/io.c
+++ b/modules/lua/libs/io.c
@@ -239,8 +239,10 @@ 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;
+    int i_err = i_res != 0 ? errno : 0;
+    lua_pushinteger( L, i_res );
+    lua_pushinteger( L, i_err );
+    return 2;
 }
 
 static const luaL_Reg vlclua_io_reg[] = {



More information about the vlc-commits mailing list