nlookup-mkdir.patch

c.turner, 03/29/2010 02:42 AM

Download (952 Bytes)

View differences:

sys/kern/vfs_nlookup.c
469 469
	    nd->nl_nch = nch;		/* remains locked */
470 470

  
471 471
	    /*
472
	     * Fast-track termination.  There is no parent directory of
473
	     * the root in the same mount from the point of view of
474
	     * the caller so return EPERM if NLC_REFDVP is specified.
475
	     * e.g. 'rmdir /' is not allowed.
472
	     * Fast-track termination. In the case of '/', there is no 
473
	     * parent directory from the point of view of the caller 
474
	     * so return either EPERM if NLC_REFDVP is specified.
475
	     * e.g. 'rmdir /' is not allowed, or return EEXIST
476
	     * for the case of 'mkdir /'.
476 477
	     */
477 478
	    if (*ptr == 0) {
478 479
		if (nd->nl_flags & NLC_REFDVP)
479
			error = EPERM;
480
			error = (nd->nl_flags & NLC_CREATE) ? EEXIST : EPERM;
480 481
		else
481 482
			error = 0;
482 483
		break;