Date: Sun, 31 Oct 2021 01:05:22 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: e5248548f95f - main - procfs: return right hardlink from /proc/curproc/file Message-ID: <202110310105.19V15Mlv015530@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e5248548f95ff1c89667847e0d945dea38adeca7 commit e5248548f95ff1c89667847e0d945dea38adeca7 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-10-29 01:43:32 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-10-31 01:05:14 +0000 procfs: return right hardlink from /proc/curproc/file Use proc_get_binpath() to get the hardlink right. PR: 248184 Reviewed by: emaste, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32738 --- sys/fs/procfs/procfs.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/sys/fs/procfs/procfs.c b/sys/fs/procfs/procfs.c index c492533c52bb..697bbfc9877a 100644 --- a/sys/fs/procfs/procfs.c +++ b/sys/fs/procfs/procfs.c @@ -69,22 +69,17 @@ int procfs_doprocfile(PFS_FILL_ARGS) { - char *fullpath; - char *freepath; - struct vnode *textvp; + char *fullpath, *freepath, *binpath; int error; freepath = NULL; + binpath = malloc(MAXPATHLEN, M_TEMP, M_WAITOK); PROC_LOCK(p); - textvp = p->p_textvp; - vhold(textvp); - PROC_UNLOCK(p); - error = vn_fullpath(textvp, &fullpath, &freepath); - vdrop(textvp); + error = proc_get_binpath(p, binpath, &fullpath, &freepath); if (error == 0) - sbuf_printf(sb, "%s", fullpath); - if (freepath != NULL) - free(freepath, M_TEMP); + sbuf_printf(sb, "%s", fullpath == NULL ? "" : fullpath); + free(binpath, M_TEMP); + free(freepath, M_TEMP); return (error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202110310105.19V15Mlv015530>