From: Thomas Veerman Date: Thu, 26 Jul 2012 15:18:21 +0000 (+0000) Subject: PM: a few Coverity inspired fixes X-Git-Tag: v3.2.1~433 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=238a9a057bd5db725cea4efc5548d691e2bbb987;p=minix.git PM: a few Coverity inspired fixes .initialize variable to prevent negative array indexing .remove dead code --- diff --git a/servers/pm/forkexit.c b/servers/pm/forkexit.c index 5980ad77c..073847bf4 100644 --- a/servers/pm/forkexit.c +++ b/servers/pm/forkexit.c @@ -47,7 +47,7 @@ int do_fork() register struct mproc *rmp; /* pointer to parent */ register struct mproc *rmc; /* pointer to child */ pid_t new_pid; - static int next_child; + static int next_child = 0; int i, n = 0, s; endpoint_t child_ep; message m; @@ -146,7 +146,7 @@ int do_srv_fork() register struct mproc *rmc; /* pointer to child */ int s; pid_t new_pid; - static int next_child; + static int next_child = 0; int i, n = 0; endpoint_t child_ep; message m; diff --git a/servers/pm/main.c b/servers/pm/main.c index 2fe9fcd26..50228c48e 100644 --- a/servers/pm/main.c +++ b/servers/pm/main.c @@ -90,18 +90,11 @@ int main() /* Check for system notifications first. Special cases. */ if (is_ipc_notify(ipc_status)) { - switch(who_p) { - case CLOCK: - expire_timers(m_in.NOTIFY_TIMESTAMP); - result = SUSPEND; /* don't reply */ - break; - default : - /* ignore notify() from unknown sender */ - result = SUSPEND; + if (who_p == CLOCK) { + expire_timers(m_in.NOTIFY_TIMESTAMP); } /* done, send reply and continue */ - if (result != SUSPEND) setreply(who_p, result); sendreply(); continue; }