]> Zhao Yanbai Git Server - minix.git/commitdiff
PM: a few Coverity inspired fixes
authorThomas Veerman <thomas@minix3.org>
Thu, 26 Jul 2012 15:18:21 +0000 (15:18 +0000)
committerThomas Veerman <thomas@minix3.org>
Mon, 30 Jul 2012 09:44:58 +0000 (09:44 +0000)
.initialize variable to prevent negative array indexing
.remove dead code

servers/pm/forkexit.c
servers/pm/main.c

index 5980ad77cc386977c65fa929323a2f30370f6d01..073847bf4cf90b94bf009b795dcc994300d80e42 100644 (file)
@@ -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;
index 2fe9fcd260fb02bf6ba882fba778cce064e85bc5..50228c48e9cdb5f8325db2c95f10ac66ff46a80f 100644 (file)
@@ -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;
        }