aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2018-02-09 09:03:34 -0600
committerRob Landley <rob@landley.net>2018-02-09 09:03:34 -0600
commit912646fc08d1b5e497f5ddb9b14e994f6b44e291 (patch)
tree110b1c702fdbaa820633c72861da49fbf0001f1f /toys/posix
parent24c63d1dd238ed762297786dbd2912f0bbaf941a (diff)
downloadtoybox-912646fc08d1b5e497f5ddb9b14e994f6b44e291.tar.gz
Andreas Gampe suggested a different fix.
(Bionic _does_ do the malloc(0)!=0 thing, the problem is pedantic access checking, not null dereference. So test count instead.)
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/ps.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/toys/posix/ps.c b/toys/posix/ps.c
index 8ee68ad6..e94902b3 100644
--- a/toys/posix/ps.c
+++ b/toys/posix/ps.c
@@ -1417,7 +1417,8 @@ static void top_common(
mix.count = 0;
while (old.count || new.count) {
- struct carveup *otb = old.tb ? *old.tb : 0, *ntb = new.tb ? *new.tb : 0;
+ struct carveup *otb = old.count ? *old.tb : 0,
+ *ntb = new.count ? *new.tb : 0;
// If we just have old for this process, it exited. Discard it.
if (old.count && (!new.count || *otb->slot < *ntb->slot)) {