Bug #2543
closedman rmdir(2) : add EINVAL to the error section
0%
Description
rmdir can return EINVAL if the directory is a mount point :
See sys/kern/vfs_syscalls.c:3997
/*
* Do not allow directories representing mount points to be
* deleted, even if empty. Check write perms on mount point
* in case the vnode is aliased (aka nullfs).
*/
if (nd->nl_nch.ncp->nc_flag & (NCF_ISMOUNTPT))
return (EINVAL);
Updated by swildner over 11 years ago
POSIX has this to say about EINVAL and EBUSY:
[EBUSY]
The directory to be removed is currently in use by the system or some process and the implementation considers this to be an error.
[EINVAL]
The path argument contains a last component that is dot.
So I think that we should actually return EBUSY instead of EINVAL for the attempt to rmdir() a directory that is a mount point.
Also, I'm not sure if we handle the "last component that is dot" case correctly yet.
Updated by jorisgio over 11 years ago
You're right, linux returns EBUSY too. I have check the pathname ending by a dot, it returnds EINVAL, hence it's correct. (By ending by a dot, I mean foo/bar/.)
Updated by swildner over 11 years ago
- Status changed from New to Closed
Fix pushed (cd6a8264ce320929480ebadd227f0a8de0763a3d).
Thanks!