From: Eli Zaretskii Date: Mon, 31 Jul 2000 06:33:58 +0000 (+0000) Subject: (child_setup) [MSDOS]: malloc pwd_var instead of X-Git-Tag: emacs-pretest-21.0.90~2544 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=16425c4a98ba4be9d7bc624d554b40785bdf7613;p=emacs.git (child_setup) [MSDOS]: malloc pwd_var instead of using alloca; free it after run_msdos_command returns --- diff --git a/src/ChangeLog b/src/ChangeLog index 7b9bcbbb4f6..228e5045b34 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2000-07-31 Eli Zaretskii + + * msdos.c (run_msdos_command): Save and restore the master + environment, for the case that child_setup signals an error. + When mirroring slashes in DOS shell commands, don't fail when + argv[2] has embedded blanks. + + * callproc.c (child_setup) [MSDOS]: malloc pwd_var instead of + using alloca; free it after run_msdos_command returns. + 2000-07-27 Dave Love * s/irix6-5.h (IRIX_FORCE_32_BITS, LD_SWITCH_SYSTEM): Don't diff --git a/src/callproc.c b/src/callproc.c index 16ae6ada73c..a79816b2f38 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -1072,7 +1072,14 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) register int i; i = STRING_BYTES (XSTRING (current_dir)); +#ifdef MSDOS + /* MSDOS must have all environment variables malloc'ed, because + low-level libc functions that launch subsidiary processes rely + on that. */ + pwd_var = (char *) xmalloc (i + 6); +#else pwd_var = (char *) alloca (i + 6); +#endif temp = pwd_var + 4; bcopy ("PWD=", pwd_var, 4); bcopy (XSTRING (current_dir)->data, temp, i); @@ -1212,6 +1219,7 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir) #ifdef MSDOS pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env); + free (pwd_var); if (pid == -1) /* An error occurred while trying to run the subprocess. */ report_file_error ("Spawning child process", Qnil);