Date: Fri, 18 Oct 2019 08:36:09 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353720 - stable/12/sys/fs/devfs Message-ID: <201910180836.x9I8a9eG059902@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Fri Oct 18 08:36:08 2019 New Revision: 353720 URL: https://svnweb.freebsd.org/changeset/base/353720 Log: MFC r353447: devfs_vptocnp(): correct the component name when node is not at top. Modified: stable/12/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/12/sys/fs/devfs/devfs_vnops.c Fri Oct 18 08:34:52 2019 (r353719) +++ stable/12/sys/fs/devfs/devfs_vnops.c Fri Oct 18 08:36:08 2019 (r353720) @@ -283,38 +283,27 @@ devfs_vptocnp(struct vop_vptocnp_args *ap) if (error != 0) return (error); - i = *buflen; + if (vp->v_type != VCHR && vp->v_type != VDIR) { + error = ENOENT; + goto finished; + } + dd = vp->v_data; + if (vp->v_type == VDIR && dd == dmp->dm_rootdir) { + *dvp = vp; + vref(*dvp); + goto finished; + } - if (vp->v_type == VCHR) { - i -= strlen(dd->de_cdp->cdp_c.si_name); - if (i < 0) { - error = ENOMEM; - goto finished; - } - bcopy(dd->de_cdp->cdp_c.si_name, buf + i, - strlen(dd->de_cdp->cdp_c.si_name)); - de = dd->de_dir; - } else if (vp->v_type == VDIR) { - if (dd == dmp->dm_rootdir) { - *dvp = vp; - vref(*dvp); - goto finished; - } - i -= dd->de_dirent->d_namlen; - if (i < 0) { - error = ENOMEM; - goto finished; - } - bcopy(dd->de_dirent->d_name, buf + i, - dd->de_dirent->d_namlen); - de = dd; - } else { - error = ENOENT; + i = *buflen; + i -= dd->de_dirent->d_namlen; + if (i < 0) { + error = ENOMEM; goto finished; } + bcopy(dd->de_dirent->d_name, buf + i, dd->de_dirent->d_namlen); *buflen = i; - de = devfs_parent_dirent(de); + de = devfs_parent_dirent(dd); if (de == NULL) { error = ENOENT; goto finished;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910180836.x9I8a9eG059902>