--- kernel/bsd/hfs/hfs_vnodeops.c 2018/04/24 18:26:05 1.1.1.1 +++ kernel/bsd/hfs/hfs_vnodeops.c 2018/04/24 18:30:55 1.1.1.2 @@ -1706,9 +1706,8 @@ hfs_chid(struct hfsnode *hp, u_int32_t f hfs_vhashinslocked(tp); } - /* Now change sibling */ - tp = VTOH(hp->h_sibling); - if (tp) { + /* Now change sibling (if any) */ + if (hp->h_sibling && (tp = VTOH(hp->h_sibling))) { hfs_vhashrem(tp); H_HINT(tp) = 0; H_FILEID(tp) = fid; @@ -2742,7 +2741,15 @@ struct vop_readdir_args /* { if (uio->uio_offset == sizeof(struct hfsdirentry)) { index = 1; } + + /* copy in the correct d_fileno */ + rootdots[0].fileno = dirID; + rootdots[1].fileno = H_DIRID(hp); + retval = uiomove((caddr_t) (rootdots + uio->uio_offset), index * sizeof(struct hfsdirentry), uio); + if (retval != 0) + goto Exit; + }; /* Compute the starting index in the directory */