svn commit: r196034 - in projects/libprocstat: sys/kern
usr.bin/fstat
Stanislav Sedov
stas at FreeBSD.org
Sun Aug 2 13:25:12 UTC 2009
Author: stas
Date: Sun Aug 2 13:25:11 2009
New Revision: 196034
URL: http://svn.freebsd.org/changeset/base/196034
Log:
- Do not fail if fullpath of the file could not be retrieved.
- Print "-" for mntdir in fstat in that case.
Modified:
projects/libprocstat/sys/kern/kern_descrip.c
projects/libprocstat/usr.bin/fstat/libprocstat.c
Modified: projects/libprocstat/sys/kern/kern_descrip.c
==============================================================================
--- projects/libprocstat/sys/kern/kern_descrip.c Sun Aug 2 11:26:23 2009 (r196033)
+++ projects/libprocstat/sys/kern/kern_descrip.c Sun Aug 2 13:25:11 2009 (r196034)
@@ -3185,10 +3185,11 @@ fill_vnode_info(struct vnode *vp, struct
freepath = NULL;
fullpath = "-";
error = vn_fullpath(curthread, vp, &fullpath, &freepath);
- if (error != 0)
- return (error);
- strlcpy(kif->kf_path, fullpath, sizeof(kif->kf_path));
- free(freepath, M_TEMP);
+ if (error == 0) {
+ strlcpy(kif->kf_path, fullpath, sizeof(kif->kf_path));
+ }
+ if (freepath != NULL)
+ free(freepath, M_TEMP);
/*
* Retrieve vnode attributes.
Modified: projects/libprocstat/usr.bin/fstat/libprocstat.c
==============================================================================
--- projects/libprocstat/usr.bin/fstat/libprocstat.c Sun Aug 2 11:26:23 2009 (r196033)
+++ projects/libprocstat/usr.bin/fstat/libprocstat.c Sun Aug 2 13:25:11 2009 (r196034)
@@ -986,7 +986,8 @@ procstat_get_vnode_info_sysctl(struct fi
if (path && *path) {
statfs(path, &stbuf);
vn->vn_mntdir = strdup(stbuf.f_mntonname);
- }
+ } else
+ vn->vn_mntdir = strdup("-");
vn->vn_dev = rdev;
if (vntype == PS_FST_VTYPE_VBLK) {
name = devname(rdev, S_IFBLK);
More information about the svn-src-projects
mailing list