Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Jun 2009 15:10:12 +0000 (UTC)
From:      Ulf Lilleengen <lulf@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r194839 - projects/libprocstat/sys/kern
Message-ID:  <200906241510.n5OFAC6q018017@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: lulf
Date: Wed Jun 24 15:10:12 2009
New Revision: 194839
URL: http://svn.freebsd.org/changeset/base/194839

Log:
  - Only set data given from VOP_GETATTR if it does not fail. If it does fail,
    that is ok, the fields will be left with zeros from an earlier bzero call.
  
  Pointed out by:		rwatson

Modified:
  projects/libprocstat/sys/kern/kern_descrip.c

Modified: projects/libprocstat/sys/kern/kern_descrip.c
==============================================================================
--- projects/libprocstat/sys/kern/kern_descrip.c	Wed Jun 24 15:00:45 2009	(r194838)
+++ projects/libprocstat/sys/kern/kern_descrip.c	Wed Jun 24 15:10:12 2009	(r194839)
@@ -2914,12 +2914,14 @@ export_vnode_for_sysctl(struct vnode *vp
 	freepath = NULL;
 	fullpath = "-";
 	FILEDESC_SUNLOCK(fdp);
-	VOP_GETATTR(vp, &va, NULL);
-	kif->kf_fsid = va.va_fsid;
-	kif->kf_fileid = va.va_fileid;
-	kif->kf_mode = MAKEIMODE(va.va_type, va.va_mode);
-	kif->kf_size = va.va_size;
-	kif->kf_rdev = va.va_rdev;
+	error = VOP_GETATTR(vp, &va, NULL);
+	if (error == 0) {
+		kif->kf_fsid = va.va_fsid;
+		kif->kf_fileid = va.va_fileid;
+		kif->kf_mode = MAKEIMODE(va.va_type, va.va_mode);
+		kif->kf_size = va.va_size;
+		kif->kf_rdev = va.va_rdev;
+	}
 	vn_fullpath(curthread, vp, &fullpath, &freepath);
 
 	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
@@ -3096,12 +3098,15 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER
 			freepath = NULL;
 			fullpath = "-";
 			FILEDESC_SUNLOCK(fdp);
-			VOP_GETATTR(vp, &va, NULL);
-			kif->kf_fsid = va.va_fsid;
-			kif->kf_fileid = va.va_fileid;
-			kif->kf_mode = MAKEIMODE(va.va_type, va.va_mode);
-			kif->kf_size = va.va_size;
-			kif->kf_rdev = va.va_rdev;
+			error = VOP_GETATTR(vp, &va, NULL);
+			if (error == 0) {
+				kif->kf_fsid = va.va_fsid;
+				kif->kf_fileid = va.va_fileid;
+				kif->kf_mode = MAKEIMODE(va.va_type,
+				    va.va_mode);
+				kif->kf_size = va.va_size;
+				kif->kf_rdev = va.va_rdev;
+			}
 			vn_fullpath(curthread, vp, &fullpath, &freepath);
 			vfslocked = VFS_LOCK_GIANT(vp->v_mount);
 			vrele(vp);



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