249 |
if (-l $bl) { |
if (-l $bl) { |
250 |
$real_bl=readlink($bl) || die "can't read link $bl: $!"; |
$real_bl=readlink($bl) || die "can't read link $bl: $!"; |
251 |
$real_bl="$BACKUP_DEST/$host/$dir/$real_bl" if (substr($real_bl,0,1) ne "/"); |
$real_bl="$BACKUP_DEST/$host/$dir/$real_bl" if (substr($real_bl,0,1) ne "/"); |
252 |
undef $real_bl if (! -e $real_bl); |
if (! -e $real_bl) { |
253 |
|
xlog($share,"latest link $bl -> $real_bl not valid, removing it"); |
254 |
|
unlink $bl || die "can't remove link $bl: $!"; |
255 |
|
undef $real_bl; |
256 |
|
} |
257 |
} |
} |
258 |
if (! $real_bl) { |
if (! $real_bl) { |
259 |
xlog($share,"no old backup, trying to find last backup,"); |
xlog($share,"no old backup, trying to find last backup"); |
260 |
if (opendir(BL_DIR, "$BACKUP_DEST/$host/$dir")) { |
if (opendir(BL_DIR, "$BACKUP_DEST/$host/$dir")) { |
261 |
my @bl_dirs = sort grep { !/^\./ && -d "$BACKUP_DEST/$host/$dir/$_" } readdir(BL_DIR); |
my @bl_dirs = sort grep { !/^\./ && -d "$BACKUP_DEST/$host/$dir/$_" } readdir(BL_DIR); |
262 |
closedir(BL_DIR); |
closedir(BL_DIR); |