Bug#608401: luatex: FTBFS on hurd-i386
tags 608401 + patch
thanks
Forgot the patch of course... (This is against 0.65.0)
Samuel
--- source/texk/web2c/luatexdir/lua/llfslibext.c.original 2010-12-30 14:02:45.000000000 +0000
+++ source/texk/web2c/luatexdir/lua/llfslibext.c 2010-12-30 14:04:25.000000000 +0000
@@ -76,11 +76,26 @@
static int Preadlink(lua_State *L) /** readlink(path) */
{
- char b[PATH_MAX];
const char *path = luaL_checkstring(L, 1);
- int n = readlink(path, b, sizeof(b));
- if (n==-1) return pusherror(L, path);
+ char *b = NULL;
+ size_t allocated = 128;
+ int n;
+ while (1) {
+ b = malloc(allocated);
+ if (!b) return pusherror(L, path);
+ n = readlink(path, b, allocated);
+ if (n == -1) {
+ free(b);
+ return pusherror(L, path);
+ }
+ if (n < allocated)
+ break;
+ /* Not enough room, try bigger */
+ allocated *= 2;
+ free(b);
+ }
lua_pushlstring(L, b, n);
+ free(b);
return 1;
}
Reply to: