summaryrefslogtreecommitdiff
path: root/luxio.c
diff options
context:
space:
mode:
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); \