From b654e1067b05d62cfa85dc0ab691e086f9bf23a4 Mon Sep 17 00:00:00 2001 From: Ian Dowse Date: Thu, 15 Feb 2001 22:42:44 +0000 Subject: [PATCH] Fix `fstat -m' (show memory-mapped files), which was broken by revision 1.25. When evaluating the termination condition for the iteration over all map entries, we must take care to use the kernel versions of all pointers. The code was comparing a kernel pointer to a pointer within a local variable, so the loop never terminated. --- usr.bin/fstat/fstat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c index 427611dffe2..49bc0801f02 100644 --- a/usr.bin/fstat/fstat.c +++ b/usr.bin/fstat/fstat.c @@ -393,8 +393,8 @@ dommap(kp) } map = &vmspace.vm_map; - for (entryp = map->header.next; entryp != &vmspace.vm_map.header; - entryp = entry.next) { + for (entryp = map->header.next; + entryp != &kp->ki_vmspace->vm_map.header; entryp = entry.next) { if (!KVM_READ(entryp, &entry, sizeof(entry))) { dprintf(stderr, "can't read vm_map_entry at %p for pid %d\n",