Bug #1701 ยป nlookup-mkdir.patch
sys/kern/vfs_nlookup.c | ||
---|---|---|
nd->nl_nch = nch; /* remains locked */
|
||
/*
|
||
* Fast-track termination. There is no parent directory of
|
||
* the root in the same mount from the point of view of
|
||
* the caller so return EPERM if NLC_REFDVP is specified.
|
||
* e.g. 'rmdir /' is not allowed.
|
||
* Fast-track termination. In the case of '/', there is no
|
||
* parent directory from the point of view of the caller
|
||
* so return either EPERM if NLC_REFDVP is specified.
|
||
* e.g. 'rmdir /' is not allowed, or return EEXIST
|
||
* for the case of 'mkdir /'.
|
||
*/
|
||
if (*ptr == 0) {
|
||
if (nd->nl_flags & NLC_REFDVP)
|
||
error = EPERM;
|
||
error = (nd->nl_flags & NLC_CREATE) ? EEXIST : EPERM;
|
||
else
|
||
error = 0;
|
||
break;
|