Jeffrey J. Kosowsky wrote at about 01:09:10 -0500 on Sunday, January 23, 2011:
> It seems there are some extra tests and computation that are not
> necessary. I will show my suggested changes with +/- style diff
> Am I missing something?
>
>
> sub MakeFileLink
> {
> my($bpc, $name, $d, $newFile, $compress) = @_;
> my($i, $rawFile);
>
> return -1 if ( !-f $name );
> + return -2 if ( !defined($rawFile = $bpc->MD52Path($d, $compress)) );
> for ( $i = -1 ; ; $i++ ) {
> - return -2 if ( !defined($rawFile = $bpc->MD52Path($d, $compress)) );
> $rawFile .= "_$i" if ( $i >= 0 );
> if ( -f $rawFile ) {
> if ( (stat(_))[3] < $bpc->{Conf}{HardLinkMax}
> && !compare($name, $rawFile) ) {
> unlink($name);
> return -3 if ( !link($rawFile, $name) );
> return 1;
> }
> - } elsif ( $newFile && -f $name && (stat($name))[3] == 1 ) {
> + } elsif ( $newFile && -f $name && (stat($_))[3] == 1 ) {
> - my($newDir);
> - ($newDir = $rawFile) =~ s{(.*)/.*}{$1};
> + $rawfile =~ m{(.*)/}
> - mkpath($newDir, 0, 0777) if ( !-d $newDir );
> + mkpath($1, 0, 0777) if ( !-d $1 );
> return -4 if ( !link($name, $rawFile) );
> return 2;
> } else {
> return 0;
> }
> }
> }
I noticed I left the final semicolon off of the line:
+ $rawfile =~ m{(.*)/}
Also, instead of:
+ } elsif ( $newFile && -f $name && (stat($_))[3] == 1 ) {
one could perhaps better use:
+ } elsif ( $newFile && (stat($fname))[3] == 1 ) {
since -f $fname was already tested above.
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki: http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/
|