aboutsummaryrefslogtreecommitdiff
path: root/nxcomp/Children.cpp
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2011-11-13 09:27:52 +0100
committerReinhard Tartler <siretart@tauware.de>2011-11-13 09:27:52 +0100
commit92239dafb601d2ee5da1554d19631267c81fe57c (patch)
tree8a2b406e1d1c66c459e6c4dc3f908b60d2feacd1 /nxcomp/Children.cpp
parentd7a8d67d760a80962821f6951caee5a9c807f5be (diff)
downloadnx-libs-92239dafb601d2ee5da1554d19631267c81fe57c.tar.gz
nx-libs-92239dafb601d2ee5da1554d19631267c81fe57c.tar.bz2
nx-libs-92239dafb601d2ee5da1554d19631267c81fe57c.zip
Imported nxcomp-3.2.0-6.tar.gznxcomp/3.2.0-6
Summary: Imported nxcomp-3.2.0-6.tar.gz Keywords: Imported nxcomp-3.2.0-6.tar.gz into Git repository
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;
+}