Messages in this thread |  | | Date | Fri, 20 Sep 1996 10:43:05 +0300 (EET DST) | From | Linus Torvalds <> | Subject | Re: POSIX feature or bug? |
| |
On Fri, 20 Sep 1996, Ulrich Windl wrote: > > This is from HP-UX 10.01 (Patchlevel 7+) > > rkdvmhp1:windl(32) % cd /tmp > rkdvmhp1:windl(33) % mkdir X > rkdvmhp1:windl(34) % cd X > rkdvmhp1:windl(35) % rmdir /tmp/X > rmdir: /tmp/X: Cannot remove mountable directory
Yes, but do the same thing in another window:
Win 1 Win 2
cd /tmp mkdir X cd X rmdir /tmp/X
See, the HP-UX and Solaris checks are just something stupid like this:
if (current_cwd == dir_to_remove) return -EINVAL;
while Digital UNIX and Linux just do not do that stupid check (and it _is_ stupid, because it doesn't "protect" against anything).
In fact, you don't even need two windows: do the following on Solaris (or HP-UX):
kruuna$ cd /tmp /tmp kruuna$ mkdir X kruuna$ cd X /tmp/X kruuna$ ( cd ; rmdir /tmp/X ) /home/fs/torvalds kruuna$ /bin/pwd pwd: cannot determine current directory!
See? It's not the OS being "clever" and noticing that the directory is in use, it's the OS being "anal" and permitting the rmdir() only if it's not the cwd of the process trying to run. I don't see the point in that kind of testing.
Linus
|  |