emacs-devel
[Top][All Lists]
Advanced

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

proced: ppid of process ID 0 can be 0


From: Juanma Barranquero
Subject: proced: ppid of process ID 0 can be 0
Date: Sat, 20 Dec 2008 03:52:40 +0100

proced.el assumes at several places (for example, at
`proced-filter-parents') that you can loop over the ppid, because
you'll eventually find a process with no parent.

That's not true with on Windows, where ppid (0) == 0. That causes a
stack failure, for example, if you hit RET (`proced-refine') over the
PPID of process 0.

I see two ways of fixing this: either removing the assumption from
proced.el, or forcing the Windows implementation of
system_process_attributes to adapt. First is more correct, second is
much easier (see tiny patch below).

Comments?

    Juanma


Index: src/w32.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/w32.c,v
retrieving revision 1.157
diff -u -2 -r1.157 w32.c
--- src/w32.c   19 Dec 2008 19:50:39 -0000      1.157
+++ src/w32.c   20 Dec 2008 02:34:39 -0000
@@ -3886,7 +3886,8 @@
                }
              attrs = Fcons (Fcons (Qcomm, decoded_cmd), attrs);
-             attrs = Fcons (Fcons (Qppid,
-                                   make_fixnum_or_float 
(pe.th32ParentProcessID)),
-                            attrs);
+             if (proc_id != 0)
+               attrs = Fcons (Fcons (Qppid,
+                                     make_fixnum_or_float 
(pe.th32ParentProcessID)),
+                              attrs);
              attrs = Fcons (Fcons (Qpri, make_number (pe.pcPriClassBase)),
                             attrs);




reply via email to

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