aboutsummaryrefslogtreecommitdiff
path: root/nxcomp/Children.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'nxcomp/Children.cpp')
-rwxr-xr-xnxcomp/Children.cpp69
1 files changed, 69 insertions, 0 deletions
diff --git a/nxcomp/Children.cpp b/nxcomp/Children.cpp
index c9b4b96ef..ec4ce35f3 100755
--- a/nxcomp/Children.cpp
+++ b/nxcomp/Children.cpp
@@ -71,6 +71,10 @@ extern char *GetClientPath();
extern int CheckParent(char *name, char *type, int parent);
+#ifdef __sun
+extern char **environ;
+#endif
+
//
// Close all the unused descriptors and
// install any signal handler that might
@@ -86,6 +90,12 @@ static void SystemCleanup(char *name);
static void MemoryCleanup(char *name);
//
+// Remove 'name' from the environment.
+//
+
+static int UnsetEnv(char *name);
+
+//
// Start a nxclient process in dialog mode.
//
@@ -187,6 +197,8 @@ int NXTransDialog(const char *caption, const char *message,
parent[DEFAULT_STRING_LIMIT - 1] = '\0';
+ UnsetEnv("LD_LIBRARY_PATH");
+
for (int i = 0; i < 2; i++)
{
if (local != 0)
@@ -409,6 +421,8 @@ int NXTransClient(const char* display)
#endif
+ UnsetEnv("LD_LIBRARY_PATH");
+
for (int i = 0; i < 2; i++)
{
execlp(command, command, NULL);
@@ -962,3 +976,58 @@ void MemoryCleanup(char *name)
EnableSignals();
}
+
+int UnsetEnv(char *name)
+{
+ int result;
+
+ #ifdef __sun
+
+ char **pEnv = environ;
+
+ int nameLen = strlen(name) + 1;
+
+ char *varName = new char[nameLen + 1];
+
+ strcpy(varName, name);
+
+ strcat(varName, "=");
+
+ pEnv = environ;
+
+ while (*pEnv != NULL)
+ {
+ if (!strncmp(varName, *pEnv, nameLen))
+ {
+ break;
+ }
+
+ *pEnv++;
+ }
+
+ while (*pEnv != NULL)
+ {
+ *pEnv = *(pEnv + 1);
+
+ pEnv++;
+ }
+
+ result = 0;
+
+ #else
+
+ #ifdef __APPLE__
+
+ unsetenv(name);
+ result = 0;
+
+ #else
+
+ result = unsetenv(name);
+
+ #endif
+
+ #endif
+
+ return result;
+}