OSDN Git Service

Thinko pointed out by Andreas Gampe (causing segfaults in top, oops).
authorRob Landley <rob@landley.net>
Thu, 8 Feb 2018 14:57:10 +0000 (08:57 -0600)
committerRob Landley <rob@landley.net>
Thu, 8 Feb 2018 14:57:10 +0000 (08:57 -0600)
toys/posix/ps.c

index fd9b54b..8ee68ad 100644 (file)
@@ -1417,7 +1417,7 @@ static void top_common(
     mix.count = 0;
 
     while (old.count || new.count) {
-      struct carveup *otb = *old.tb, *ntb = *new.tb;
+      struct carveup *otb = old.tb ? *old.tb : 0, *ntb = new.tb ? *new.tb : 0;
 
       // If we just have old for this process, it exited. Discard it.
       if (old.count && (!new.count || *otb->slot < *ntb->slot)) {