diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2016-09-05 21:50:17 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2016-09-05 21:50:17 +0100 |
commit | cc04e50af7994b1f2648d0042f1d77df97202ecf (patch) | |
tree | f888f9f7170a785f6a1dfc998e0951b9ef8ee7b7 | |
parent | c1aa5b4fc7a27d4e5eede9ba492eb1c940127394 (diff) | |
download | luxio-cc04e50af7994b1f2648d0042f1d77df97202ecf.tar.gz |
Fix use of PATH_MAX in luxio_getcwd()
-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); |