Project

General

Profile

Actions

Bug #2543

closed

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

Added by jorisgio over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
04/10/2013
Due date:
% Done:

0%

Estimated time:

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);
Actions #1

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.

Actions #2

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/.)

Actions #3

Updated by swildner over 11 years ago

  • Status changed from New to Closed

Fix pushed (cd6a8264ce320929480ebadd227f0a8de0763a3d).

Thanks!

Actions

Also available in: Atom PDF