summaryrefslogtreecommitdiff
path: root/proclist.c
diff options
context:
space:
mode:
Diffstat (limited to 'proclist.c')
-rw-r--r--proclist.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/proclist.c b/proclist.c
index 148e4bc..75b61a2 100644
--- a/proclist.c
+++ b/proclist.c
@@ -52,12 +52,18 @@ proclist_lookup (void *hook, const char *name, struct node **np)
char *endp;
pid_t pid;
+ /* Self-lookups should not end up here. */
+ assert (name[0]);
+
+ /* No leading zeros allowed */
+ if (name[0] == '0' && name[1])
+ return ENOENT;
+
pid = strtol (name, &endp, 10);
- if (name[0] == '0' || !name[0] || *endp)
+ if (*endp)
return ENOENT;
- *np = process_make_node (pl->process, pid);
- return *np ? 0 : ENOMEM;
+ return process_lookup_pid (pl->process, pid, np);
}
struct node *