Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 May 2012 10:15:46 +0000 (UTC)
From:      Gleb Kurtsou <gleb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r235602 - in head: lib/libprocstat usr.bin/fstat
Message-ID:  <201205181015.q4IAFkuA044824@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gleb
Date: Fri May 18 10:15:46 2012
New Revision: 235602
URL: http://svn.freebsd.org/changeset/base/235602

Log:
  Don't cast inode number or file size down to long or unsigned.
  
  Since ino_t size is about to change to 64-bits, casts to long would
  truncate 64-bit numbers on 32-bit archs.
  
  Sponsored by:	Google Summer of Code 2011

Modified:
  head/lib/libprocstat/cd9660.c
  head/lib/libprocstat/common_kvm.c
  head/usr.bin/fstat/fstat.c

Modified: head/lib/libprocstat/cd9660.c
==============================================================================
--- head/lib/libprocstat/cd9660.c	Fri May 18 10:01:31 2012	(r235601)
+++ head/lib/libprocstat/cd9660.c	Fri May 18 10:15:46 2012	(r235602)
@@ -84,7 +84,7 @@ isofs_filestat(kvm_t *kd, struct vnode *
 	}
 	vn->vn_fsid = dev2udev(kd, mnt.im_dev);
 	vn->vn_mode = (mode_t)isonode.inode.iso_mode;
-	vn->vn_fileid = (long)isonode.i_number;
-	vn->vn_size = (u_long)isonode.i_size;
+	vn->vn_fileid = isonode.i_number;
+	vn->vn_size = isonode.i_size;
 	return (0);
 }

Modified: head/lib/libprocstat/common_kvm.c
==============================================================================
--- head/lib/libprocstat/common_kvm.c	Fri May 18 10:01:31 2012	(r235601)
+++ head/lib/libprocstat/common_kvm.c	Fri May 18 10:15:46 2012	(r235602)
@@ -99,9 +99,9 @@ ufs_filestat(kvm_t *kd, struct vnode *vp
 	 * comparisons
 	 */
 	vn->vn_fsid = dev2udev(kd, inode.i_dev);
-	vn->vn_fileid = (long)inode.i_number;
+	vn->vn_fileid = inode.i_number;
 	vn->vn_mode = (mode_t)inode.i_mode;
-	vn->vn_size = (u_long)inode.i_size;
+	vn->vn_size = inode.i_size;
 	return (0);
 }
 

Modified: head/usr.bin/fstat/fstat.c
==============================================================================
--- head/usr.bin/fstat/fstat.c	Fri May 18 10:01:31 2012	(r235601)
+++ head/usr.bin/fstat/fstat.c	Fri May 18 10:15:46 2012	(r235602)
@@ -244,7 +244,7 @@ print_file_info(struct procstat *procsta
 		for (d = devs; d != NULL; d = d->next)
 			if (d->fsid == vn.vn_fsid) {
 				fsmatch = 1;
-				if ((unsigned)d->ino == vn.vn_fileid) {
+				if (d->ino == vn.vn_fileid) {
 					filename = d->name;
 					break;
 				}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205181015.q4IAFkuA044824>