On Thu, 16 Aug 2012, Jon Trulson wrote:

On Thu, 16 Aug 2012, Marcin Cieslak wrote:

Hello,

After enabling session log in .dtprofile:

[...]

Looking at the XiG source, seems I ran into and fixed this problem for
both linux and CSRG_BASED, I added some specific code to
_DtEnvRemove() at least.  I'll post a patch with these fixes so maybe
you can try it.



Can you try the attached patch and let me know?

--
Jon Trulson

"If the Martian rope-a-dope don't get him, he'll get himself, he'll
 come in too fast and punch himself out."
             - one of my brothers, referring to the Curiosity landing.
From 27d5cc033df63b96e72dc3c8708c2e441278bc9f Mon Sep 17 00:00:00 2001
From: Jon Trulson <j...@radscan.com>
Date: Thu, 16 Aug 2012 18:26:50 -0600
Subject: [PATCH] DtSvc:EnvControl: Use more modern and less dangerous methods
 of manipulating the env.

This should work for both linux and the BSD's... It should hopefully
solve the corrupted environment errors Marcin sees on fbsd 9 amd64.
---
 cde/lib/DtSvc/DtUtil2/EnvControl.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/cde/lib/DtSvc/DtUtil2/EnvControl.c 
b/cde/lib/DtSvc/DtUtil2/EnvControl.c
index 20358f0..bf046fc 100644
--- a/cde/lib/DtSvc/DtUtil2/EnvControl.c
+++ b/cde/lib/DtSvc/DtUtil2/EnvControl.c
@@ -424,6 +424,10 @@ _DtEnvControl(
                        _postDtEnvironment.binPath = XtMalloc(bytes_needed);
 #ifdef sun
                        if (ptr = strstr(tempString, "/usr/openwin/bin"))
+#elif defined(CSRG_BASED)
+                       if (ptr = strstr(tempString, "/usr/X11R6/bin"))
+#elif defined(linux)
+                       if (ptr = strstr(tempString, "/usr/bin"))
 #else
                        if (ptr = strstr(tempString, "/usr/bin/X11"))
 #endif
@@ -817,6 +821,10 @@ static void _EnvAdd
 {
   _DtSvcProcessLock();
   if (envBitVector & bv_flag) {
+#if defined(CSRG_BASED) || defined(linux)
+      setenv(envVar, envVarSetting + strlen(envVar) + 1, 1);
+#else
+
       register int i;
       size_t envVarLen = strlen(envVar);
       char *envPtr = NULL;
@@ -850,6 +858,7 @@ static void _EnvAdd
             /* This should never happen */
            putenv(strdup(envVarSetting));
     }
+#endif /* linux || CSRG_BASED */
   }
   else
     putenv(strdup(envVarSetting));
@@ -919,6 +928,16 @@ _DtEnvRemove(
                       && ( p[len] == '=' )
                       && !strncmp(p, str, len))
                {
+#if defined(linux) || defined(CSRG_BASED)
+                 /* JET - 2/19/99
+                    It seems much safer to let libc worry about this
+                    rather than try to do it ourselves.  
+                    */
+
+                 if (str)
+                   unsetenv(str);
+#else
+
                    freeMe = pEnviron2[index];
 
                    /* just move the last one into the gap - any
@@ -930,6 +949,7 @@ _DtEnvRemove(
                    pEnviron2[count - 1] = NULL;
 
                    XtFree (freeMe);
+#endif /* linux || CSRG_BASED */
                    return(0);
                }
                pEnviron++;
-- 
1.7.9.5

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

Reply via email to