[Research] unlink() not POSIX-conform?

Florian La Roche (florian@suse.de)
Fri, 14 May 1999 08:51:11 +0200


I remember a discussion on linux-kernel@vger that unlink() may or may not
remove directories and if it does not, it has to return EPERM (and not
e.g. EISDIR) to be POSIX-compliant.

Test program (to be run as root :-):
--------------------------------------------------------------
#include <unistd.h>
main(){
unlink("/mnt");
unlink("/proc");
}
--------------------------------------------------------------

Return values for kernel 2.0.37pre11:
unlink("/mnt") = -1 EPERM (Operation not permitted)
unlink("/proc") = -1 EPERM (Operation not permitted)

Return values for kernel 2.2.7ac1:
unlink("/mnt") = -1 EISDIR (Is a directory)
unlink("/proc") = -1 ENOENT (No such file or directory)

The return value for /proc on a 2.2 kernel seems totally bogus. :-)
These are not critical bugs, but someone might clean this up for the
2.2/2.3 kernel...

Thanks a lot,

Florian La Roche

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/