aboutsummaryrefslogtreecommitdiffstats
path: root/src/callproc.c
diff options
context:
space:
mode:
authorGlenn Morris2012-07-09 00:07:24 -0700
committerGlenn Morris2012-07-09 00:07:24 -0700
commitd01ba2f14965203aef327c2cebf1474af0f12f90 (patch)
tree713be84a86219010d326af47bde19f0e267f5331 /src/callproc.c
parent61a116066f7e8c58ece6aaa09aa245ff32764a02 (diff)
downloademacs-d01ba2f14965203aef327c2cebf1474af0f12f90.tar.gz
emacs-d01ba2f14965203aef327c2cebf1474af0f12f90.zip
Stop ns builds polluting the environment with EMACSDATA, EMACSDOC
It's bad form for one part of a program to communicate with another part by making persistent changes to the environment of all subsequent child processes. For example, it can cause odd bugs when building Emacs from within Emacs (eg bug#6401, maybe). * nsterm.m (ns_etc_directory): New function, split from ns_init_paths. (ns_init_paths): Do not set EMACSDATA, EMACSDOC. * nsterm.h (ns_etc_directory): Add it. * callproc.c [HAVE_NS]: Include nsterm.h. (init_callproc_1, init_callproc) [HAVE_NS]: Use ns_etc_directory.
Diffstat (limited to 'src/callproc.c')
-rw-r--r--src/callproc.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/callproc.c b/src/callproc.c
index 39fcb99c4b5..52825bc9dc2 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -61,6 +61,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
61#include "msdos.h" 61#include "msdos.h"
62#endif 62#endif
63 63
64#ifdef HAVE_NS
65#include "nsterm.h"
66#endif
67
64#ifndef USE_CRT_DLL 68#ifndef USE_CRT_DLL
65extern char **environ; 69extern char **environ;
66#endif 70#endif
@@ -1513,13 +1517,26 @@ init_callproc_1 (void)
1513{ 1517{
1514 char *data_dir = egetenv ("EMACSDATA"); 1518 char *data_dir = egetenv ("EMACSDATA");
1515 char *doc_dir = egetenv ("EMACSDOC"); 1519 char *doc_dir = egetenv ("EMACSDOC");
1520#ifdef HAVE_NS
1521 const char *etc_dir = ns_etc_directory ();
1522#endif
1516 1523
1517 Vdata_directory 1524 Vdata_directory
1518 = Ffile_name_as_directory (build_string (data_dir ? data_dir 1525 = Ffile_name_as_directory (build_string (data_dir ? data_dir
1519 : PATH_DATA)); 1526#ifdef HAVE_NS
1527 : (etc_dir ? etc_dir : PATH_DATA)
1528#else
1529 : PATH_DATA
1530#endif
1531 ));
1520 Vdoc_directory 1532 Vdoc_directory
1521 = Ffile_name_as_directory (build_string (doc_dir ? doc_dir 1533 = Ffile_name_as_directory (build_string (doc_dir ? doc_dir
1522 : PATH_DOC)); 1534#ifdef HAVE_NS
1535 : (etc_dir ? etc_dir : PATH_DOC)
1536#else
1537 : PATH_DOC
1538#endif
1539 ));
1523 1540
1524 /* Check the EMACSPATH environment variable, defaulting to the 1541 /* Check the EMACSPATH environment variable, defaulting to the
1525 PATH_EXEC path from epaths.h. */ 1542 PATH_EXEC path from epaths.h. */
@@ -1537,6 +1554,17 @@ init_callproc (void)
1537 1554
1538 register char * sh; 1555 register char * sh;
1539 Lisp_Object tempdir; 1556 Lisp_Object tempdir;
1557#ifdef HAVE_NS
1558 if (data_dir == 0)
1559 {
1560 const char *etc_dir = ns_etc_directory ();
1561 if (etc_dir)
1562 {
1563 data_dir = alloca (strlen (etc_dir) + 1);
1564 strcpy (data_dir, etc_dir);
1565 }
1566 }
1567#endif
1540 1568
1541 if (!NILP (Vinstallation_directory)) 1569 if (!NILP (Vinstallation_directory))
1542 { 1570 {