summaryrefslogtreecommitdiff
path: root/luxio.c
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2016-09-05 21:50:17 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2016-09-05 21:50:17 +0100
commitcc04e50af7994b1f2648d0042f1d77df97202ecf (patch)
treef888f9f7170a785f6a1dfc998e0951b9ef8ee7b7 /luxio.c
parentc1aa5b4fc7a27d4e5eede9ba492eb1c940127394 (diff)
downloadluxio-cc04e50af7994b1f2648d0042f1d77df97202ecf.tar.bz2
Fix use of PATH_MAX in luxio_getcwd()
Diffstat (limited to 'luxio.c')
-rw-r--r--luxio.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/luxio.c b/luxio.c
index 1daff3b..7ca5b87 100644
--- a/luxio.c
+++ b/luxio.c
@@ -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);