devfs - Fix incorrect st_size reporting
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 1 Apr 2010 16:16:23 +0000 (09:16 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 1 Apr 2010 16:24:51 +0000 (09:24 -0700)
* The default reported st_size should be 0 and not sizeof(devfs_node).

* Fixes incorrect reporting for /dev/null and other devices.

Reported-by: marino2, numerous others (it slipped through the cracks)
sys/vfs/devfs/devfs_vnops.c

index 7284355..cf63814 100644 (file)
@@ -547,9 +547,9 @@ devfs_getattr(struct vop_getattr_args *ap)
        vap->va_type = ap->a_vp->v_type;
        vap->va_mode = node->mode;
        vap->va_fileid = DEVFS_NODE(ap->a_vp)->d_dir.d_ino ;
-       vap->va_flags = 0; /* XXX: what should this be? */
+       vap->va_flags = 0;
        vap->va_blocksize = DEV_BSIZE;
-       vap->va_bytes = vap->va_size = sizeof(struct devfs_node);
+       vap->va_bytes = vap->va_size = 0;
 
        vap->va_fsid = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0];