Re: rmdir system call

sct@dcs.ed.ac.uk
Sat, 23 Mar 96 01:09 GMT


Hi,

On Wed, 20 Mar 1996 08:39:40 +0000, Nick Randell <nick@metrica.co.uk> said:

> Ulrich Windl wrote:
>>
>> On 20 Mar 96 at 7:26, Nick Randell wrote:
>>
>> > I have some code which is calling rmdir and passing the directory name
>> > is with a trailing '/'.
>> > eg rmdir("/tmp/nick/")
>> > The system call is returning with 'ENOENT'.
>> > The same code works ok on other operating systems. (HPUX, IRIX, AIX ...)

Then they are broken, or at least non-POSIX-compliant --- this isn't
legal for POSIX.

>> > If Linux is wrong, what can I do about it?

It isn't.

> Should you be able to call rmdir with a trailing '/'?

No, you should expect it to always fail, probably with ENOTEMPTY or
EBUSY. According to POSIX, any path ending in "/" is precisely
equivalent for all purposes to the same path with a trailing "."
appended, with the single exception that the trailing "." does not
count towards the pathlength when checking for path-too-long errors.

So, rmdir("/tmp/nick/") should be precisely equivalent to
rmdir("/tmp/nick/."), which should obviously fail.

Cheers,
Stephen.

--
Stephen Tweedie <sct@dcs.ed.ac.uk>
Department of Computer Science, Edinburgh University, Scotland.