Re: Bug#669059: webkit-1.8.0-2: FTBFS on hurd-*
On Mon, 2012-04-16 at 23:28 +0200, Svante Signell wrote:
> > > In some way the updated patch was not attached. The updated patch will
> > > follow soon...
> >
> > Please also take into account Pino's remarks from debian-hurd, which
> > will actually keep the pointer non-static.
>
> Yes, Pino's solution was nice. Thanks Pino! Will update the patch to
> avoid having static buffer pointers.
Attached is an updated patch. This patch together with the one in
#664810 would enable a successful build of webkit-1.8.0 for GNU/Hurd.
Thanks!
--- a/Source/ThirdParty/ANGLE/src/compiler/osinclude.h 2012-02-19 18:47:57.000000000 +0100
+++ b/Source/ThirdParty/ANGLE/src/compiler/osinclude.h 2012-04-15 09:20:30.000000000 +0200
@@ -16,7 +16,7 @@
#define ANGLE_OS_WIN
#elif defined(__APPLE__) || defined(__linux__) || \
defined(__FreeBSD__) || defined(__OpenBSD__) || \
- defined(__sun) || defined(ANDROID)
+ defined(__sun) || defined(ANDROID) || defined(__GNU__)
#define ANGLE_OS_POSIX
#else
#error Unsupported platform.
--- a/Source/JavaScriptCore/wtf/gobject/GlibUtilities.cpp 2012-02-19 18:45:45.000000000 +0100
+++ b/Source/JavaScriptCore/wtf/gobject/GlibUtilities.cpp 2012-04-18 08:18:39.000000000 +0200
@@ -25,6 +25,8 @@
#include <wtf/text/WTFString.h>
#else
#include <limits.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <unistd.h>
#endif
@@ -40,11 +42,21 @@
#elif OS(UNIX)
CString getCurrentExecutablePath()
{
- static char readLinkBuffer[PATH_MAX];
- ssize_t result = readlink("/proc/curproc/file", readLinkBuffer, PATH_MAX);
- if (result == -1)
- return CString();
- return CString(readLinkBuffer, result);
+ struct stat sb;
+ char *readLinkBuffer;
+ ssize_t result;
+ result = lstat("/proc/curproc/file", &sb);
+ readLinkBuffer = (char*)malloc(sb.st_size + 1);
+ if (readLinkBuffer == NULL)
+ return CString();
+ result = readlink("/proc/curproc/file", readLinkBuffer, sb.st_size + 1);
+ CString resultString;
+ if (result >= 0 && result < sb.st_size)
+ resultString = CString(readLinkBuffer, result);
+ else
+ resultString = CString();
+ free(readLinkBuffer);
+ return resultString;
}
#elif OS(WINDOWS)
CString getCurrentExecutablePath()
Reply to: