Mirsad Goran Todorovac wrote:
It would suffice that: linkat (AT_CWDFD, source, AT_CWDFD, dest, 0) == 0 || unlink (dest) == 0 && linkat (AT_CWDFD, source, AT_CWDFD, dest, 0) == 0; be replaced with: linkat (AT_CWDFD, source, AT_CWDFD, dest_tmp, 0) == 0 && renameat (AT_CWDFD, dest_tmp, AT_CWDFD, dest) == 0;
It isn't that simple, since renameat is a no-op if the source and destination are already hard links. So the patch you sent in would not work.
Anyway, I'm not disagreeing with the basic idea, I'm merely saying I don't see why we should have an option to keep the old behavior. Anybody who really wants the old behavior can do 'rm -f new && ln old new' instead.
