summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2009-04-27 18:03:50 -0700
committerStig Thormodsrud <stig@vyatta.com>2009-04-27 18:03:50 -0700
commit6098a862a26de6526354513295a911cb46f6f56b (patch)
tree059873c4c904a19e736bdbb638e037493b428161
parent806a207b85dc4c7f9b94b3975f3b7eccb9ee20bf (diff)
downloadvyatta-cfg-system-6098a862a26de6526354513295a911cb46f6f56b.tar.gz
vyatta-cfg-system-6098a862a26de6526354513295a911cb46f6f56b.zip
Replace md5 compare with a (hopefully) lighter-weight file compare.
-rw-r--r--scripts/vyatta-banner.pl14
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/vyatta-banner.pl b/scripts/vyatta-banner.pl
index 8c3db846..7ae35edf 100644
--- a/scripts/vyatta-banner.pl
+++ b/scripts/vyatta-banner.pl
@@ -33,8 +33,7 @@ use Vyatta::Config;
use Getopt::Long;
use File::Copy;
-use Digest::MD5 qw(md5_hex);
-use Digest::file qw(digest_file_hex);
+use File::Compare;
use strict;
use warnings;
@@ -61,9 +60,14 @@ sub is_same_as_file {
my ($file, $value) = @_;
return if ! -e $file;
- my $fdigest = digest_file_hex($file, "MD5");
- my $vdigest = md5_hex("$value");
- return 1 if $fdigest eq $vdigest;
+
+ my $mem_file;
+ open my $MF, '+<', \$mem_file or die "couldn't open memfile $!\n";
+ print $MF $value;
+ seek($MF, 0, 0);
+
+ my $rc = compare($file, $MF);
+ return 1 if $rc == 0;
return;
}