Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Aug 2011 20:13:17 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r224915 - head/sys/fs/procfs
Message-ID:  <201108162013.p7GKDHB6071744@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Aug 16 20:13:17 2011
New Revision: 224915
URL: http://svn.freebsd.org/changeset/base/224915

Log:
  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)

Modified:
  head/sys/fs/procfs/procfs.c

Modified: head/sys/fs/procfs/procfs.c
==============================================================================
--- head/sys/fs/procfs/procfs.c	Tue Aug 16 20:07:47 2011	(r224914)
+++ head/sys/fs/procfs/procfs.c	Tue Aug 16 20:13:17 2011	(r224915)
@@ -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);
 }
 
 /*



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