Bug #2543
closed
man rmdir(2) : add EINVAL to the error section
Added by jorisgio over 11 years ago.
Updated over 11 years ago.
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);
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.
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/.)
- Status changed from New to Closed
Fix pushed (cd6a8264ce320929480ebadd227f0a8de0763a3d).
Thanks!
Also available in: Atom
PDF