aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32.c
diff options
context:
space:
mode:
authorEli Zaretskii <[email protected]>2008-08-09 19:05:54 +0000
committerEli Zaretskii <[email protected]>2008-08-09 19:05:54 +0000
commit754a2d1380c19e854549b84af6f96e94aef0d77f (patch)
tree1b8ab80819b586bc4b56eaa94deaf5b5a5de016f /src/w32.c
parent3af03101a78a582ce3b788b56009323a95638b83 (diff)
(w32_system_process_attributes): If the process does not exist, return nil.
Diffstat (limited to 'src/w32.c')
-rw-r--r--src/w32.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/w32.c b/src/w32.c
index 1d3c518291..2407cb171b 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -3642,6 +3642,7 @@ w32_system_process_attributes (pid)
Lisp_Object cmd_str, decoded_cmd, tem;
HANDLE h_snapshot, h_proc;
DWORD proc_id;
+ int found_proc = 0;
char uname[UNLEN+1], gname[GNLEN+1], domain[1025];
DWORD ulength = sizeof (uname), dlength = sizeof (domain), trash;
DWORD glength = sizeof (gname);
@@ -3701,6 +3702,7 @@ w32_system_process_attributes (pid)
attrs = Fcons (Fcons (Qthcount,
make_fixnum_or_float (pe.cntThreads)),
attrs);
+ found_proc = 1;
break;
}
}
@@ -3708,6 +3710,12 @@ w32_system_process_attributes (pid)
CloseHandle (h_snapshot);
}
+ if (!found_proc)
+ {
+ UNGCPRO;
+ return Qnil;
+ }
+
h_proc = OpenProcess (PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
FALSE, proc_id);
/* If we were denied a handle to the process, try again after