emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/src ChangeLog callproc.c


From: Andreas Schwab
Subject: [Emacs-diffs] emacs/src ChangeLog callproc.c
Date: Wed, 29 Apr 2009 19:55:51 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Andreas Schwab <schwab> 09/04/29 19:55:51

Modified files:
        src            : ChangeLog callproc.c 

Log message:
        (Fcall_process): Fix GC protection.  Make sure
        current buffer is always restored.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/ChangeLog?cvsroot=emacs&r1=1.7519&r2=1.7520
http://cvs.savannah.gnu.org/viewcvs/emacs/src/callproc.c?cvsroot=emacs&r1=1.246&r2=1.247

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/src/ChangeLog,v
retrieving revision 1.7519
retrieving revision 1.7520
diff -u -b -r1.7519 -r1.7520
--- ChangeLog   29 Apr 2009 08:52:37 -0000      1.7519
+++ ChangeLog   29 Apr 2009 19:55:49 -0000      1.7520
@@ -1,3 +1,8 @@
+2009-04-29  Andreas Schwab  <address@hidden>
+
+       * callproc.c (Fcall_process): Fix GC protection.  Make sure
+       current buffer is always restored.
+
 2009-04-29  YAMAMOTO Mitsuharu  <address@hidden>
 
        * atimer.c (init_atimer): Also clear stopped_atimers.

Index: callproc.c
===================================================================
RCS file: /sources/emacs/emacs/src/callproc.c,v
retrieving revision 1.246
retrieving revision 1.247
diff -u -b -r1.246 -r1.247
--- callproc.c  2 Mar 2009 21:03:21 -0000       1.246
+++ callproc.c  29 Apr 2009 19:55:51 -0000      1.247
@@ -153,18 +153,26 @@
 }
 
 Lisp_Object
-call_process_cleanup (fdpid)
-     Lisp_Object fdpid;
+call_process_cleanup (arg)
+     Lisp_Object arg;
 {
+  Lisp_Object fdpid = Fcdr (arg);
+#if defined (MSDOS)
+  Lisp_Object file;
+#else
+  int pid;
+#endif
+
+  Fset_buffer (Fcar (arg));
+
 #if defined (MSDOS)
   /* for MSDOS fdpid is really (fd . tempfile)  */
-  register Lisp_Object file;
   file = Fcdr (fdpid);
   emacs_close (XFASTINT (Fcar (fdpid)));
   if (strcmp (SDATA (file), NULL_DEVICE) != 0)
     unlink (SDATA (file));
 #else /* not MSDOS */
-  register int pid = XFASTINT (Fcdr (fdpid));
+  pid = XFASTINT (Fcdr (fdpid));
 
   if (call_process_exited)
     {
@@ -231,7 +239,6 @@
   int count = SPECPDL_INDEX ();
 
   register const unsigned char **new_argv;
-  struct buffer *old = current_buffer;
   /* File to use for stderr in the child.
      t means use same as standard output.  */
   Lisp_Object error_file;
@@ -399,9 +406,9 @@
     }
   /* Search for program; barf if not found.  */
   {
-    struct gcpro gcpro1;
+    struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
-    GCPRO1 (current_dir);
+    GCPRO4 (infile, buffer, current_dir, error_file);
     openp (Vexec_path, args[0], Vexec_suffixes, &path, make_number (X_OK));
     UNGCPRO;
   }
@@ -422,9 +429,9 @@
   if (nargs > 4)
     {
       register int i;
-      struct gcpro gcpro1, gcpro2, gcpro3;
+      struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
 
-      GCPRO3 (infile, buffer, current_dir);
+      GCPRO5 (infile, buffer, current_dir, path, error_file);
       argument_coding.dst_multibyte = 0;
       for (i = 4; i < nargs; i++)
        {
@@ -630,10 +637,13 @@
 #if defined(MSDOS)
   /* MSDOS needs different cleanup information.  */
   record_unwind_protect (call_process_cleanup,
-                        Fcons (make_number (fd[0]), build_string (tempfile)));
+                        Fcons (Fcurrent_buffer (),
+                               Fcons (make_number (fd[0]),
+                                      build_string (tempfile))));
 #else
   record_unwind_protect (call_process_cleanup,
-                        Fcons (make_number (fd[0]), make_number (pid)));
+                        Fcons (Fcurrent_buffer (),
+                               Fcons (make_number (fd[0]), make_number 
(pid))));
 #endif /* not MSDOS */
 
 
@@ -820,8 +830,6 @@
 
   immediate_quit = 0;
 
-  set_buffer_internal (old);
-
   /* Don't kill any children that the subprocess may have left behind
      when exiting.  */
   call_process_exited = 1;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]