Re: rmdir system call

Andries.Brouwer@cwi.nl
Thu, 21 Mar 1996 01:08:13 +0100


Nick Randell:

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

: Like my last posting, which is right?

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

The last question is easy: remove this trailing slash.
Which is right is more tricky, since POSIX.1 contradicts
itself. The classical interpretation is that an empty
pathname refers to the current directory, so that
"/dir/" is equivalent to "/dir/.".
But POSIX explicitly forbids this use of empty names.
Nevertheless, the definition of `pathname' says:
If the pathname refers to a directory, it may also
have one or more trailing slashes.
Probably Linux should accept such filenames, and probably
you should not use them.

Andries