summaryrefslogtreecommitdiffstats
path: root/sys/fs/procfs
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2011-08-16 20:13:17 +0000
committerkib <kib@FreeBSD.org>2011-08-16 20:13:17 +0000
commit43a83c2777cdaad9bd5d9a0b094657f4e3114198 (patch)
tree3b42489abea76fc383537227fb3ed88787648b7e /sys/fs/procfs
parent011f42054d1f861cd2435866ba646fa0cf752103 (diff)
downloadFreeBSD-src-43a83c2777cdaad9bd5d9a0b094657f4e3114198.zip
FreeBSD-src-43a83c2777cdaad9bd5d9a0b094657f4e3114198.tar.gz
Do not return success and a string "unknown" when vn_fullpath() was unable
to resolve the path of the text vnode of the process. The behaviour is very confusing for any consumer of the procfs, in particular, java. Reported and tested by: bf MFC after: 2 weeks Approved by: re (bz)
Diffstat (limited to 'sys/fs/procfs')
-rw-r--r--sys/fs/procfs/procfs.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/fs/procfs/procfs.c b/sys/fs/procfs/procfs.c
index 8b69eb1..514e279 100644
--- a/sys/fs/procfs/procfs.c
+++ b/sys/fs/procfs/procfs.c
@@ -67,20 +67,23 @@
int
procfs_doprocfile(PFS_FILL_ARGS)
{
- char *fullpath = "unknown";
- char *freepath = NULL;
+ char *fullpath;
+ char *freepath;
struct vnode *textvp;
+ int error;
+ freepath = NULL;
PROC_LOCK(p);
textvp = p->p_textvp;
vhold(textvp);
PROC_UNLOCK(p);
- vn_fullpath(td, textvp, &fullpath, &freepath);
+ error = vn_fullpath(td, textvp, &fullpath, &freepath);
vdrop(textvp);
- sbuf_printf(sb, "%s", fullpath);
- if (freepath)
+ if (error == 0)
+ sbuf_printf(sb, "%s", fullpath);
+ if (freepath != NULL)
free(freepath, M_TEMP);
- return (0);
+ return (error);
}
/*
OpenPOWER on IntegriCloud