Subject: Re: rmdir(".")
To: Roland Illig <rillig@NetBSD.org>
From: John Nemeth <jnemeth@victoria.tc.ca>
List: tech-kern
Date: 09/09/2005 01:12:16
On Jan 30,  4:32am, Roland Illig wrote:
} 
} is there any technical reason for not allowing rmdir("."), or is it just 
} to protect the user from something {s,}he might eventually not want to 
} do? I'm not interested in a flame war, I just want to know the reasons 
} for it. (I'm still too young to know everything about Unix-like systems. ;))
} 
} http://www.opengroup.org/onlinepubs/009695399/functions/rmdir.html says 
} removing the current working directory is allowed.
} 
} By the way, the error code is wrong. It should not be EINVAL, but EBUSY.

     This is not entirely clear.  The page you reference says this:

     If the directory is the root directory or the current working
     directory of any process, it is unspecified whether the function
     succeeds, or whether it shall fail and set errno to [EBUSY].

Note that "." is your current working directory.

}-- End of excerpt from Roland Illig