View | Details | Raw Unified | Return to bug 59739 | Differences between
and this patch

Collapse All | Expand All

(-)sys/kern/vfs_syscalls.c (-3 / +17 lines)
Lines 3587-3594 Link Here
3587
	    AUDITVNODE1, pathseg, old, oldfd, td);
3587
	    AUDITVNODE1, pathseg, old, oldfd, td);
3588
#endif
3588
#endif
3589
3589
3590
	if ((error = namei(&fromnd)) != 0)
3590
	if ((error = namei(&fromnd)) != 0) {
3591
		/* Translate error code for rename("/", "dir2"). */
3592
		if (error == EISDIR)
3593
			error = EINVAL;
3591
		return (error);
3594
		return (error);
3595
	}
3592
	fvfslocked = NDHASGIANT(&fromnd);
3596
	fvfslocked = NDHASGIANT(&fromnd);
3593
	tvfslocked = 0;
3597
	tvfslocked = 0;
3594
#ifdef MAC
3598
#ifdef MAC
Lines 3737-3744 Link Here
3737
	NDINIT_AT(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE | AUDITVNODE1,
3741
	NDINIT_AT(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE | AUDITVNODE1,
3738
	    segflg, path, fd, td);
3742
	    segflg, path, fd, td);
3739
	nd.ni_cnd.cn_flags |= WILLBEDIR;
3743
	nd.ni_cnd.cn_flags |= WILLBEDIR;
3740
	if ((error = namei(&nd)) != 0)
3744
	if ((error = namei(&nd)) != 0) {
3745
		/* Translate error code for mkdir("/"). */
3746
		if (error == EISDIR)
3747
			error = EEXIST;
3741
		return (error);
3748
		return (error);
3749
	}
3742
	vfslocked = NDHASGIANT(&nd);
3750
	vfslocked = NDHASGIANT(&nd);
3743
	vp = nd.ni_vp;
3751
	vp = nd.ni_vp;
3744
	if (vp != NULL) {
3752
	if (vp != NULL) {
Lines 3825-3834 Link Here
3825
	bwillwrite();
3833
	bwillwrite();
3826
	NDINIT_AT(&nd, DELETE, LOCKPARENT | LOCKLEAF | MPSAFE | AUDITVNODE1,
3834
	NDINIT_AT(&nd, DELETE, LOCKPARENT | LOCKLEAF | MPSAFE | AUDITVNODE1,
3827
	    pathseg, path, fd, td);
3835
	    pathseg, path, fd, td);
3828
	if ((error = namei(&nd)) != 0)
3836
	if ((error = namei(&nd)) != 0) {
3837
		/* Translate error code for rmdir("/"). */
3838
		if (error == EISDIR)
3839
			error = EBUSY;
3829
		return (error);
3840
		return (error);
3841
	}
3830
	vfslocked = NDHASGIANT(&nd);
3842
	vfslocked = NDHASGIANT(&nd);
3831
	vp = nd.ni_vp;
3843
	vp = nd.ni_vp;
3844
	/* XXX namei() takes care of this case. */
3832
	if (vp->v_type != VDIR) {
3845
	if (vp->v_type != VDIR) {
3833
		error = ENOTDIR;
3846
		error = ENOTDIR;
3834
		goto out;
3847
		goto out;
Lines 3841-3846 Link Here
3841
		goto out;
3854
		goto out;
3842
	}
3855
	}
3843
	/*
3856
	/*
3857
	 * XXX namei() takes care of this case.
3844
	 * The root of a mounted filesystem cannot be deleted.
3858
	 * The root of a mounted filesystem cannot be deleted.
3845
	 */
3859
	 */
3846
	if (vp->v_vflag & VV_ROOT) {
3860
	if (vp->v_vflag & VV_ROOT) {

Return to bug 59739