aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Schwab2008-09-07 20:35:14 +0000
committerAndreas Schwab2008-09-07 20:35:14 +0000
commit1aa83b226a79e35a9e5c63585f62a081bcc7f55e (patch)
treecc94c96c3c1c93775a62944e769ebbf2c471fa91 /src
parente542c7fd3ab01c5c54d5cf34f55a73e13e1d5536 (diff)
downloademacs-1aa83b226a79e35a9e5c63585f62a081bcc7f55e.tar.gz
emacs-1aa83b226a79e35a9e5c63585f62a081bcc7f55e.zip
(Fcall_process): Don't hold references to string data
across garbage collection. Move initialisation of new_argv down to avoid compiler bug.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/callproc.c12
2 files changed, 13 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 67cd1c3bb06..17796a27326 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12008-09-07 Andreas Schwab <schwab@suse.de>
2
3 * callproc.c (Fcall_process): Don't hold references to string data
4 across garbage collection. Move initialisation of new_argv down
5 to avoid compiler bug.
6
12008-09-07 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> 72008-09-07 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
2 8
3 * process.c (Fsystem_process_attributes): Doc fix. 9 * process.c (Fsystem_process_attributes): Doc fix.
diff --git a/src/callproc.c b/src/callproc.c
index fdfa4c78083..5d94b05b608 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -226,8 +226,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
226 int bufsize = CALLPROC_BUFFER_SIZE_MIN; 226 int bufsize = CALLPROC_BUFFER_SIZE_MIN;
227 int count = SPECPDL_INDEX (); 227 int count = SPECPDL_INDEX ();
228 228
229 register const unsigned char **new_argv 229 register const unsigned char **new_argv;
230 = (const unsigned char **) alloca ((max (2, nargs - 2)) * sizeof (char *));
231 struct buffer *old = current_buffer; 230 struct buffer *old = current_buffer;
232 /* File to use for stderr in the child. 231 /* File to use for stderr in the child.
233 t means use same as standard output. */ 232 t means use same as standard output. */
@@ -414,7 +413,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
414 && SREF (path, 1) == ':') 413 && SREF (path, 1) == ':')
415 path = Fsubstring (path, make_number (2), Qnil); 414 path = Fsubstring (path, make_number (2), Qnil);
416 415
417 new_argv[0] = SDATA (path); 416 new_argv = (const unsigned char **)
417 alloca (max (2, nargs - 2) * sizeof (char *));
418 if (nargs > 4) 418 if (nargs > 4)
419 { 419 {
420 register int i; 420 register int i;
@@ -428,13 +428,15 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
428 if (CODING_REQUIRE_ENCODING (&argument_coding)) 428 if (CODING_REQUIRE_ENCODING (&argument_coding))
429 /* We must encode this argument. */ 429 /* We must encode this argument. */
430 args[i] = encode_coding_string (&argument_coding, args[i], 1); 430 args[i] = encode_coding_string (&argument_coding, args[i], 1);
431 new_argv[i - 3] = SDATA (args[i]);
432 } 431 }
433 UNGCPRO; 432 UNGCPRO;
434 new_argv[nargs - 3] = 0; 433 for (i = 4; i < nargs; i++)
434 new_argv[i - 3] = SDATA (args[i]);
435 new_argv[i - 3] = 0;
435 } 436 }
436 else 437 else
437 new_argv[1] = 0; 438 new_argv[1] = 0;
439 new_argv[0] = SDATA (path);
438 440
439#ifdef MSDOS /* MW, July 1993 */ 441#ifdef MSDOS /* MW, July 1993 */
440 if ((outf = egetenv ("TMPDIR"))) 442 if ((outf = egetenv ("TMPDIR")))