summaryrefslogtreecommitdiffstats
path: root/usr.bin/fstat
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2001-02-15 22:42:44 +0000
committeriedowse <iedowse@FreeBSD.org>2001-02-15 22:42:44 +0000
commit6c9e1e94819fa0b6e13a6eecbd8ea05476b0f430 (patch)
treecf18cd6bf0c5efc646730349ccc6788785b6073c /usr.bin/fstat
parentd8f8e6f36868d18e0a99ce901a1a9ac454322da8 (diff)
downloadFreeBSD-src-6c9e1e94819fa0b6e13a6eecbd8ea05476b0f430.zip
FreeBSD-src-6c9e1e94819fa0b6e13a6eecbd8ea05476b0f430.tar.gz
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.
Diffstat (limited to 'usr.bin/fstat')
-rw-r--r--usr.bin/fstat/fstat.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c
index 427611d..49bc0801 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",
OpenPOWER on IntegriCloud