On 11/29/2012 05:35 PM, Josh Stone wrote:
> Well disallowing the same input and output is an easy heuristic [...]
BTW, a colleague pointed out to me that disallowing the same input and
output by *name* is also flawed in the presence of hardlinks. To be
really sure about the file you're clobbering, you'd need to stat it and
compare the dev/ino pair to the input.
In that scenario, the rename() scheme will leave the new content
disconnected, and any other hardlinked paths with remain with the old
content. I think that's usually what you want when changing hardlinked
files, but it's worth noting.
|