address@hidden (Bob Proulx) writes:
> I think the reason for the question might be for what purpose is the
> lstat() call there? It is there to tell if the destination is a
> directory and if so then it converts the rename to a rename to a
> file in the subdirectory, also as required by POSIX.
There are actually two lstat calls; one for the directory, and one for
the existing-destination check. Presumably one could be optimized
away, if someone is ambitious.