Corrected two errors with the crash backup mechanism, one minor, one
very major. The filename created had two slashes in the string
("/tmp//MAG...") because the temporary directory already has a slash
in the string. This makes no practical difference but looks odd when
printed to the terminal. The major error is that the Tcl script
that re-establishes the timer after a backup had a typo that caused
the timer never to be reset, resulting in crash backup files that are
created and written once but never again. This egregious error has
now finally been fixed.
This commit is contained in:
parent
f4b210a9c0
commit
5cf1a46061
|
|
@ -1145,7 +1145,8 @@ DBFileRecovery(filename)
|
|||
while ((dp = readdir(cwd)) != NULL)
|
||||
{
|
||||
char *doslash = (tempdir[strlen(tempdir) - 1] == '/') ? "" : "/";
|
||||
int n = snprintf(tempname, sizeof(tempname), "%s%s%s", tempdir, doslash, dp->d_name);
|
||||
int n = snprintf(tempname, sizeof(tempname), "%s%s%s", tempdir,
|
||||
doslash, dp->d_name);
|
||||
ASSERT(n < sizeof(tempname), "tempname");
|
||||
snptr = tempname + strlen(tempdir);
|
||||
if (!strncmp(snptr, "MAG", 3))
|
||||
|
|
@ -5575,7 +5576,7 @@ DBWriteBackup(filename, archive, doforall)
|
|||
pid = (int)getpid();
|
||||
|
||||
doslash = (tempdir[strlen(tempdir) - 1] == '/') ? "" : "/";
|
||||
sprintf(template, "%s/MAG%d.XXXXXX", tempdir, pid);
|
||||
sprintf(template, "%s%sMAG%d.XXXXXX", tempdir, doslash, pid);
|
||||
|
||||
fd = mkstemp(template);
|
||||
if (fd == -1)
|
||||
|
|
|
|||
|
|
@ -57,11 +57,17 @@ proc magic::resumeall {} {
|
|||
proc magic::makecrashbackup {} {
|
||||
global Opts
|
||||
|
||||
*bypass crash save
|
||||
if {![catch set Opts(backupinterval)]} {
|
||||
if {[catch {*bypass crash save} errmsg]} {
|
||||
puts stderr "Crash backup save error: $errmsg"
|
||||
}
|
||||
if {![catch {set Opts(backupinterval)}]} {
|
||||
if {$Opts(backupinterval) > 0} {
|
||||
after $Opts(backupinterval) magic::makecrashbackup
|
||||
} else {
|
||||
puts stderr "Warning: Crash backups halted due to interval of $Opts(backupinterval)"
|
||||
}
|
||||
} else {
|
||||
puts stderr "Warning: Crash backups halted due to no interval being set."
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +94,7 @@ proc magic::crashbackups {{option start}} {
|
|||
|
||||
switch -exact $option {
|
||||
start {
|
||||
if {[catch set Opts(backupinterval)]} {
|
||||
if {[catch {set Opts(backupinterval)}]} {
|
||||
set Opts(backupinterval) 600000
|
||||
}
|
||||
if {$Opts(backupinterval) > 0} {
|
||||
|
|
@ -96,7 +102,7 @@ proc magic::crashbackups {{option start}} {
|
|||
}
|
||||
}
|
||||
resume {
|
||||
if {![catch set Opts(backupinterval)]} {
|
||||
if {![catch {set Opts(backupinterval)}]} {
|
||||
if {$Opts(backupinterval) > 0} {
|
||||
after $Opts(backupinterval) magic::makecrashbackup
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue