Skip to content

Commit

Permalink
[backup] bs_dodup: chomp the cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Aug 18, 2015
1 parent 1fc574e commit 51bad93
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/backend/bs_dodup
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ sub update_dod {
mkdir_p($repodir) unless -d $repodir;

my $cookie = readstr("$repodir/doddata.cookie", 1);
chomp $cookie;
$cookie =~ s/^(\d+ )//s if $cookie; # strip lastcheck time
my $newfile = "$repodir/doddata.new.$$";
unlink($newfile);
Expand Down Expand Up @@ -401,7 +402,7 @@ sub scan_dodsdir {
if ($startup) {
# get lastcheck from old cookie
my $cookie = readstr("$reporoot/$prpa/:full/doddata.cookie", 1) || '';
$doddata->{'lastcheck'} = $1 if $cookie =~ /^(\d+) /;
$doddata->{'lastcheck'} = $1 if $cookie =~ /^(\d+) /s;
}
$doddata->{'lastcheck'} ||= 0;
$newdoddatas{$prpa} = $doddata;
Expand All @@ -421,6 +422,7 @@ sub check_dod {
$doddata->{'haderror'} = 1;
# update lastcheck time in cookie
my $cookie = readstr("$reporoot/$prpa/:full/doddata.cookie", 1) || '';
chomp $cookie;
$cookie =~ s/^(\d+ )//s if $cookie; # strip lastcheck time
mkdir_p("$reporoot/$prpa/:full");
writestr("$reporoot/$prpa/:full/.doddata.cookie", "$reporoot/$prpa/:full/doddata.cookie", "$now $cookie\n");
Expand Down

0 comments on commit 51bad93

Please sign in to comment.