]> git.eshelyaron.com Git - emacs.git/commitdiff
(sigchld_handler): Change type of pid to pid_t. Scan deleted_pid_list
authorChong Yidong <cyd@stupidchicken.com>
Sat, 17 Mar 2007 18:16:03 +0000 (18:16 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Sat, 17 Mar 2007 18:16:03 +0000 (18:16 +0000)
explicitly to avoid using Fmember which don't know about mark bits and
make_fixnum_or_float which may malloc.  Reported by Andreas Schwab.

src/process.c

index 975d92f36f1be264cc7d24f885254ebd5a42ce88..f6990c2ff194a29b0137ca483e52ea8206f3e0f4 100644 (file)
@@ -6486,7 +6486,7 @@ sigchld_handler (signo)
 
   while (1)
     {
-      register EMACS_INT pid;
+      pid_t pid;
       WAITTYPE w;
       Lisp_Object tail;
 
@@ -6530,11 +6530,15 @@ sigchld_handler (signo)
       /* Find the process that signaled us, and record its status.  */
 
       /* The process can have been deleted by Fdelete_process.  */
-      tail = Fmember (make_fixnum_or_float (pid), deleted_pid_list);
-      if (!NILP (tail))
+      for (tail = deleted_pid_list; GC_CONSP (tail); tail = XCDR (tail))
        {
-         Fsetcar (tail, Qnil);
-         goto sigchld_end_of_loop;
+         Lisp_Object xpid = XCAR (tail);
+         if ((GC_INTEGERP (xpid) && pid == (pid_t) XINT (xpid))
+             || (GC_FLOATP (xpid) && pid == (pid_t) XFLOAT_DATA (xpid)))
+           {
+             XSETCAR (tail, Qnil);
+             goto sigchld_end_of_loop;
+           }
        }
 
       /* Otherwise, if it is asynchronous, it is in Vprocess_alist.  */