diff options
Diffstat (limited to 'core/src/xmake/io/filelock_open.c')
| -rw-r--r-- | core/src/xmake/io/filelock_open.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/src/xmake/io/filelock_open.c b/core/src/xmake/io/filelock_open.c index e9687ba54..2afb173d3 100644 --- a/core/src/xmake/io/filelock_open.c +++ b/core/src/xmake/io/filelock_open.c @@ -47,13 +47,15 @@ tb_int_t xm_io_filelock_open(lua_State *lua) { // init file lock tb_long_t tryn = 2; tb_filelock_ref_t lock = tb_null; - while (!lock && tryn-- > 0) + while (!lock && tryn-- > 0) { lock = tb_filelock_init_from_path(path, tb_file_info(path, tb_null) ? TB_FILE_MODE_RW : TB_FILE_MODE_RW | TB_FILE_MODE_CREAT); - if (lock) + } + if (lock) { xm_lua_pushpointer(lua, (tb_pointer_t)lock); - else + } else { lua_pushnil(lua); + } return 1; } |
