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)
This commit is contained in:
Konstantin Belousov 2011-08-16 20:13:17 +00:00
parent 9c00bb9190
commit 4c023a3365
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=224915

View File

@ -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);
}
/*