Suggested fix for Solaris lack-of-setenv problem
Derek Atkins
warlord@MIT.EDU
16 Nov 2001 22:43:58 -0500
This patch will use putenv() instead of setenv() if the
latter does not exist.
-derek
Index: src/gnc-module/gnc-module.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnc-module/gnc-module.c,v
retrieving revision 1.11
diff -u -r1.11 gnc-module.c
--- src/gnc-module/gnc-module.c 2001/11/16 20:50:59 1.11
+++ src/gnc-module/gnc-module.c 2001/11/17 03:43:13
@@ -3,6 +3,8 @@
* Copyright 2001 Linux Developers Group, Inc.
*************************************************************/
+#include "config.h"
+
#include <stdlib.h>
#include <string.h>
#include <glib.h>
@@ -118,6 +120,14 @@
envt = g_strdup("");
}
+#ifndef HAVE_SETENV
+ {
+ char *tmp = g_strdup_printf("LD_LIBRARY_PATH=%s", envt);
+ g_free(envt);
+ envt = tmp;
+ }
+#endif
+
for(lp=dirs; lp; lp=lp->next)
{
char *tmp = g_strdup_printf("%s:%s", envt, (char *) lp->data);
@@ -126,7 +136,12 @@
g_free(lp->data);
}
g_list_free(dirs);
+
+#ifdef HAVE_SETENV
if(setenv("LD_LIBRARY_PATH", envt, 1) == -1)
+#else
+ if(putenv(envt) != 0)
+#endif
{
g_warning ("gnc-module failed to set LD_LIBRARY_PATH");
}
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH
warlord@MIT.EDU PGP key available