link.pl: make failures fatal
Don't just log things, we should stop hard...
This commit is contained in:
parent
da2e501700
commit
def9376769
|
@ -35,19 +35,19 @@ sub good_link ($$) {
|
||||||
if ($symlink_farm) {
|
if ($symlink_farm) {
|
||||||
print "Symlink: $dest => $src\n" if ($link_verbose >= 3);
|
print "Symlink: $dest => $src\n" if ($link_verbose >= 3);
|
||||||
if (not symlink ($src, $dest)) {
|
if (not symlink ($src, $dest)) {
|
||||||
print STDERR "Symlink from $src to $dest failed: $!\n";
|
die "Symlink from $src to $dest failed: $!\n";
|
||||||
}
|
}
|
||||||
} elsif ($link_copy) {
|
} elsif ($link_copy) {
|
||||||
print "Copy: $dest => $src\n" if ($link_verbose >= 3);
|
print "Copy: $dest => $src\n" if ($link_verbose >= 3);
|
||||||
if (system("cp -ap $src $dest")) {
|
if (system("cp -ap $src $dest")) {
|
||||||
my $err_num = $? >> 8;
|
my $err_num = $? >> 8;
|
||||||
my $sig_num = $? & 127;
|
my $sig_num = $? & 127;
|
||||||
print STDERR "Copy from $src to $dest failed: cp exited with error code $err_num, signal $sig_num\n";
|
die "Copy from $src to $dest failed: cp exited with error code $err_num, signal $sig_num\n";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print "Hardlink: $dest => $src\n" if ($link_verbose >= 3);
|
print "Hardlink: $dest => $src\n" if ($link_verbose >= 3);
|
||||||
if (not link ($src, $dest)) {
|
if (not link ($src, $dest)) {
|
||||||
print STDERR "Link from $src to $dest failed: $!\n";
|
die "Link from $src to $dest failed: $!\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ sub real_file ($) {
|
||||||
if ($to = readlink($link)) {
|
if ($to = readlink($link)) {
|
||||||
$link = $dir . $to;
|
$link = $dir . $to;
|
||||||
} else {
|
} else {
|
||||||
print STDERR "Can't readlink $link: $!\n";
|
die "Can't readlink $link: $!\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue