Replace two link calls with rename_link_xf, and change the subsequent
error handling to use $@ iff appropriate.
Part of the fix to #910730.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
printdebug "considering saving $f: ";
printdebug "considering saving $f: ";
- if (link $f, $upper_f) {
+ if (rename_link_xf 1, $f, $upper_f) {
- } elsif ((printdebug "($!) "),
+ } elsif ((printdebug "($@) "),
- fail f_ "saving %s: %s", "$buildproductsdir/$f", $!;
+ fail f_ "saving %s: %s", "$buildproductsdir/$f", $@;
} elsif (!$refetched) {
printdebug "no need.\n";
} elsif (!$refetched) {
printdebug "no need.\n";
- } elsif (link $f, "$upper_f,fetch") {
+ } elsif (rename_link_xf 1, $f, "$upper_f,fetch") {
printdebug "linked (using ...,fetch).\n";
printdebug "linked (using ...,fetch).\n";
- } elsif ((printdebug "($!) "),
+ } elsif ((printdebug "($@) "),
- fail f_ "saving %s: %s", "$buildproductsdir/$f,fetch", $!;
+ fail f_ "saving %s: %s", "$buildproductsdir/$f,fetch", $@;
} else {
printdebug "cannot.\n";
}
} else {
printdebug "cannot.\n";
}