[code] [textadept] Empty environment in spawn

From: Chris Emerson <c-ta.att.mail.nosreme.org>
Date: Thu, 21 Apr 2016 21:53:26 +0100

Hi,

I got around to looking into why I was getting errors from compile commands.
On Linux/curses, lspawn passes a NULL envp to execvpe if no environment is
specified, which means a completely empty environment for the child
(including HOME).

The following patch fixes it for me:

--- lspawn_1.4/lspawn.c 2016-02-25 09:39:24.000000000 +0000
+++ ./lspawn.c 2016-04-21 21:50:50.903699999 +0100
@@ -503,10 +503,10 @@
                 strerror(errno));
         exit(EXIT_FAILURE);
       }
+ extern char **environ;
 #if __linux__
- execvpe(argv[0], argv, envp); // does not return on success
+ execvpe(argv[0], argv, envp? envp : environ); // does not return on success
 #else
- extern char **environ;
       if (envp) environ = envp;
       execvp(argv[0], argv); // does not return on success
 #endif

Chris

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Thu 21 Apr 2016 - 16:53:26 EDT

This archive was generated by hypermail 2.2.0 : Fri 22 Apr 2016 - 06:52:22 EDT