summaryrefslogtreecommitdiff
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
parent7b0780336ccf0a531a9ed0d4f9d67cb320c4c2b8 (diff)
downloadluxio-c1aa5b4fc7a27d4e5eede9ba492eb1c940127394.tar.bz2
Rename luxio_constants.h to luxio_constants.inc
-rw-r--r--.gitignore2
-rw-r--r--Makefile8
-rw-r--r--luxio.c9
-rw-r--r--luxio_constants.inc.in (renamed from luxio_constants.h.in)0
4 files changed, 10 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index 62ec5b6..a9d8b51 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-luxio_constants.h
+luxio_constants.inc
luxio.so
luxio-5.1.o
luxio-5.2.o
diff --git a/Makefile b/Makefile
index d4c1055..33edf49 100644
--- a/Makefile
+++ b/Makefile
@@ -118,9 +118,9 @@ LUALIBS := $(patsubst %,luxio/%.lua, \
clean:
- $(RM) *.so *.o luxio_constants.h luxio-5.1 luxio-5.2
+ $(RM) *.so *.o luxio_constants.inc luxio-5.1 luxio-5.2
-luxio_constants.h: luxio_constants.h.in const-proc.lua
+luxio_constants.inc: luxio_constants.inc.in const-proc.lua
$(LUA_REPL) ./const-proc.lua < $^ > $@
lua-5.1: luxio-5.1.so luxio-5.1
@@ -159,8 +159,8 @@ luxio-5.2: lua-5.2.c luxio-5.2.o
###
-luxio-5.1.o: luxio.c luxio_constants.h
+luxio-5.1.o: luxio.c luxio_constants.inc
$(CC) $(CFLAGS) -fPIC $(LUA51_INC) -c $< -o $@
-luxio-5.2.o: luxio.c luxio_constants.h
+luxio-5.2.o: luxio.c luxio_constants.inc
$(CC) $(CFLAGS) -fPIC $(LUA52_INC) -c $< -o $@
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); \
diff --git a/luxio_constants.h.in b/luxio_constants.inc.in
index 50fb646..50fb646 100644
--- a/luxio_constants.h.in
+++ b/luxio_constants.inc.in