summaryrefslogtreecommitdiff
path: root/core/src/xmake/os/getown.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/xmake/os/getown.c')
-rw-r--r--core/src/xmake/os/getown.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/core/src/xmake/os/getown.c b/core/src/xmake/os/getown.c
index d032a44b8..3d002cb96 100644
--- a/core/src/xmake/os/getown.c
+++ b/core/src/xmake/os/getown.c
@@ -22,16 +22,16 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* trace
*/
-#define TB_TRACE_MODULE_NAME "getown"
-#define TB_TRACE_MODULE_DEBUG (0)
+#define TB_TRACE_MODULE_NAME "getown"
+#define TB_TRACE_MODULE_DEBUG (0)
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
*/
#include "prefix.h"
#ifndef TB_CONFIG_OS_WINDOWS
-# include <unistd.h>
-# include <sys/stat.h>
+#include <unistd.h>
+#include <sys/stat.h>
#endif
/* //////////////////////////////////////////////////////////////////////////////////////
@@ -41,19 +41,18 @@
#ifndef TB_CONFIG_OS_WINDOWS
// get owner by a given path
-tb_int_t xm_os_getown(lua_State* lua)
-{
- // check
+tb_int_t xm_os_getown(lua_State *lua) {
tb_assert_and_check_return_val(lua, 0);
// get the pathname
- tb_char_t const* pathname = luaL_checkstring(lua, 1);
+ tb_char_t const *pathname = luaL_checkstring(lua, 1);
tb_check_return_val(pathname, 0);
// get stat
struct stat sts;
- if (stat(pathname, &sts) != 0)
+ if (stat(pathname, &sts) != 0) {
return 0;
+ }
// push
lua_newtable(lua);
@@ -64,7 +63,6 @@ tb_int_t xm_os_getown(lua_State* lua)
lua_pushinteger(lua, sts.st_gid);
lua_settable(lua, -3);
- // ok
return 1;
}