Bug #2543

man rmdir(2) : add EINVAL to the error section

Added by jorisgio over 1 year ago. Updated over 1 year ago.

Status:ClosedStart date:04/10/2013
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

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);

History

#1 Updated by swildner over 1 year 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.

#2 Updated by jorisgio over 1 year 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/.)

#3 Updated by swildner over 1 year ago

  • Status changed from New to Closed

Fix pushed (cd6a8264ce320929480ebadd227f0a8de0763a3d).

Thanks!

Also available in: Atom PDF