Re: [PATCH] Do _not_ call unlink on a directory
- From
- Scott Lamb <slamb@slamb.org>
- Date
- Jul 16, 2007, 21:23 UTC
- Message-ID
- <469BE1D4.1070408@slamb.org>
- In-Reply-To
- <alpine.LFD.0.999.0707161332280.20061@woody.linux-foundation.org>
Linus Torvalds wrote:
Show 7 quoted lines
> No, but we don't *want* the "rmdir for directories" part! > > That's the whole point. > > Calling "remove()" would be *wrong*. We want the *sane* "unlink()" > behaviour, where it only removes files, and returns an error for > directories.
Of course, but when used immediately after stat() says the path does not refer to a directory, I would prefer SUS remove() (rmdir() for directories) to Solaris unlink() (break_filesystem() on directories).
But Solaris remove() is broken, too, so it's a moot point. The post-patch behavior is good enough - as you said, it won't happen during reasonable usage and the problem's not unique to git.
Best regards, Scott
-- Scott Lamb <http://www.slamb.org/>