Re: abiword: FTBFS on hurd-i386
On Wed, 2011-11-09 at 09:38 +0100, Svante Signell wrote:
> Package: abiword
> Version: 2.9.1-0.1
> Severity: important
> Tags: patch
> User: debian-hurd@lists.debian.org
> Usertags: hurd
>
> Hi,
>
> the attached tiny patch solves the FTBFS problems of abiword on
> GNU/Hurd. In the first path config.h is included to make possible to
> check if TOOLKIT_GTK is defined. The second part use dynamic memory
> allocation to avoid the absence of a PATH_MAX definition for GNU/Hurd.
> The patch has been tested with a small program on GNU/Linux and
> GNU/Hurd.
>
> Thanks!
Attached is an updated patch, taking the glib versions of malloc and
free into account. Additionally a redundant free statement was removed.
Thanks!
diff -ur abiword-2.9.1/src/af/util/xp/ut_path.h abiword-2.9.1.modified/src/af/util/xp/ut_path.h
--- abiword-2.9.1/src/af/util/xp/ut_path.h 2009-12-13 10:45:47.000000000 +0100
+++ abiword-2.9.1.modified/src/af/util/xp/ut_path.h 2011-11-09 09:26:11.000000000 +0100
@@ -29,6 +29,8 @@
#include <limits.h>
#endif
+#include "config.h"
+
/* GTK build supports platforms without PATH_MAX; we leave the warning in for
* other platforms to avoid headaches
*/
diff -ur abiword-2.9.1/src/af/xap/gtk/xap_UnixApp.cpp abiword-2.9.1.modified/src/af/xap/gtk/xap_UnixApp.cpp
--- abiword-2.9.1/src/af/xap/gtk/xap_UnixApp.cpp 2011-05-09 09:32:28.000000000 +0200
+++ abiword-2.9.1.modified/src/af/xap/gtk/xap_UnixApp.cpp 2011-11-09 15:58:06.000000000 +0100
@@ -271,12 +271,13 @@
{
// FIXME: this code sucks hard
- char buf[PATH_MAX];
+ char * buf = NULL;
// see if ABIWORD_DATADIR was set in the environment
const char * sz = getenv("ABIWORD_DATADIR");
if (sz && *sz)
{
+ buf = (gchar *)g_malloc(strlen(sz)+1);
strcpy(buf,sz);
char * p = buf;
int len = strlen(p);
@@ -290,6 +291,7 @@
if (p[len-1]=='/') // trim trailing slash
p[len-1] = 0;
XAP_App::_setAbiSuiteLibDir(p);
+ g_free(buf);
return;
}
Reply to: