summaryrefslogtreecommitdiff
path: root/luxio.c
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2016-09-05 21:19:15 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2016-09-05 21:49:58 +0100
commitc1aa5b4fc7a27d4e5eede9ba492eb1c940127394 (patch)
tree262b6029b9b27a27e29198cbedaa89e339f15336 /luxio.c
parent7b0780336ccf0a531a9ed0d4f9d67cb320c4c2b8 (diff)
downloadluxio-c1aa5b4fc7a27d4e5eede9ba492eb1c940127394.tar.bz2
Rename luxio_constants.h to luxio_constants.inc
Diffstat (limited to 'luxio.c')
-rw-r--r--luxio.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/luxio.c b/luxio.c
index 94aacef..1daff3b 100644
--- a/luxio.c
+++ b/luxio.c
@@ -1072,12 +1072,13 @@ luxio_readlink(lua_State *L) /* POSIX.1-2001, Unknown location */
static int
luxio_mkstemp(lua_State *L)
{
- char fnamebuf[PATH_MAX];
size_t infname_len;
const char *infname = luaL_optlstring(L, 1, "lux_XXXXXX", &infname_len);
+ size_t buflen = pathconf(infname, _PC_PATH_MAX) + 256;
+ char fnamebuf[buflen];
int fd, saved_errno;
-
- if (infname_len > (PATH_MAX - 1)) {
+ printf("infname=%s (len %zd), buflen=%zd\n", infname, infname_len, buflen);
+ if (infname_len > (buflen - 1)) {
lua_pushinteger(L, -1);
lua_pushinteger(L, EINVAL);
return 2;
@@ -3990,7 +3991,7 @@ luxio_bitop_functions[] = {
{ NULL, NULL }
};
-#include "luxio_constants.h"
+#include "luxio_constants.inc"
#define NUMERIC_CONSTANT(x) do { lua_pushstring(L, #x); \
lua_pushinteger(L, x); \