Subject: Re: bin/21302
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,>
From: Daniel de Kok <danieldk@pobox.com>
List: netbsd-bugs
Date: 09/27/2006 11:55:01
The following reply was made to PR bin/21302; it has been noted by GNATS.
From: Daniel de Kok <danieldk@pobox.com>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/21302
Date: Wed, 27 Sep 2006 13:54:59 +0200
--17pEHd4RhPHOinZp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
How about this patch? I am not very familiar with the filesystem code,
but this fixes the segfault and prints correct information for the ext2
I tested this with.
-- Daniel
--17pEHd4RhPHOinZp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pstat-ext2fs.diff"
Index: pstat.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/pstat/pstat.c,v
retrieving revision 1.95
diff -u -r1.95 pstat.c
--- pstat.c 25 May 2006 01:49:30 -0000 1.95
+++ pstat.c 27 Sep 2006 11:30:01 -0000
@@ -514,12 +514,15 @@
ext2fs_print(struct vnode *vp, int ovflw)
{
struct inode inode, *ip = &inode;
+ struct ext2fs_dinode dip;
char flags[sizeof(ufs_flags) / sizeof(ufs_flags[0])];
char dev[4 + 1 + 7 + 1]; /* 12bit marjor + 20bit minor */
char *name;
mode_t type;
KGETRET(VTOI(vp), &inode, sizeof(struct inode), "vnode's inode");
+ KGETRET(ip->i_din.e2fs_din, &dip, sizeof (struct ext2fs_dinode),
+ "inode's dinode");
/*
* XXX need to to locking state.
@@ -528,17 +531,17 @@
(void)getflags(ufs_flags, flags, ip->i_flag);
PRWORD(ovflw, " %*llu", 7, 1, (unsigned long long)ip->i_number);
PRWORD(ovflw, " %*s", 6, 1, flags);
- type = ip->i_e2fs_mode & S_IFMT;
- if (S_ISCHR(ip->i_e2fs_mode) || S_ISBLK(ip->i_e2fs_mode)) {
+ type = dip.e2di_mode & S_IFMT;
+ if (S_ISCHR(dip.e2di_mode) || S_ISBLK(dip.e2di_mode)) {
if (usenumflag ||
- (name = devname(ip->i_e2fs_rdev, type)) == NULL) {
+ (name = devname(dip.e2di_rdev, type)) == NULL) {
snprintf(dev, sizeof(dev), "%d,%d",
- major(ip->i_e2fs_rdev), minor(ip->i_e2fs_rdev));
+ major(dip.e2di_rdev), minor(dip.e2di_rdev));
name = dev;
}
PRWORD(ovflw, " %*s", 8, 1, name);
} else
- PRWORD(ovflw, " %*u", 8, 1, (u_int)ip->i_e2fs_size);
+ PRWORD(ovflw, " %*u", 8, 1, (u_int)dip.e2di_size);
return (0);
}
--17pEHd4RhPHOinZp--