Commit 4b4ce47e authored by Johny Mattsson's avatar Johny Mattsson
Browse files

Fix file listing on submounts.

parent a0c9085c
...@@ -44,8 +44,13 @@ static int file_list( lua_State* L ) ...@@ -44,8 +44,13 @@ static int file_list( lua_State* L )
lua_newtable( L ); lua_newtable( L );
struct dirent *e; struct dirent *e;
while ((e = readdir(dir))) { while ((e = readdir(dir))) {
char *fname;
asprintf(&fname, "%s/%s", dirname, e->d_name);
if (!fname)
return luaL_error(L, "no memory");
struct stat st = { 0, }; struct stat st = { 0, };
stat(e->d_name, &st); stat(fname, &st);
free(fname);
lua_pushinteger(L, st.st_size); lua_pushinteger(L, st.st_size);
lua_setfield(L, -2, e->d_name); lua_setfield(L, -2, e->d_name);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment