diff options
Diffstat (limited to 'luxio.c')
-rw-r--r-- | luxio.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -938,9 +938,10 @@ luxio_chdir(lua_State *L) /* 5.2.1 */ static int luxio_getcwd(lua_State *L) /* 5.2.2 */ { - char buf[PATH_MAX]; + size_t buflen = pathconf("/", _PC_PATH_MAX) + 256; + char buf[buflen]; - if (getcwd(buf, PATH_MAX) == NULL) { + if (getcwd(buf, buflen) == NULL) { lua_pushnil(L); } else { lua_pushstring(L, buf); |