From e787870eb438bd875ceb408d84aca0444396e132 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 12 Nov 2009 21:32:59 +0100 Subject: [PATCH] top: fix segfault for $if_running The "name" field may be zero, which makes strcmp() freak out. --- src/top.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/top.c b/src/top.c index 980cc4c8..45965571 100644 --- a/src/top.c +++ b/src/top.c @@ -131,7 +131,7 @@ struct process *get_process_by_name(const char *name) struct process *p = first_process; while (p) { - if (!strcmp(p->name, name)) + if (p->name && !strcmp(p->name, name)) return p; p = p->next; }