Improved error checking for existence of a .snap directory to
generate snapshots in when -L is requested. If the .snap directory does not exist, or is not a directory, issue a warning and revert to the non- live behavior. Obtained from: St. Bernard Software RAPID
This commit is contained in:
parent
0b29d18074
commit
bb68fc2b6e
@ -237,9 +237,9 @@ This option is ignored for unmounted or read-only file systems.
|
||||
If the
|
||||
.Pa .snap
|
||||
directory does not exist in the root of the file system being dumped,
|
||||
the
|
||||
a warning will be issued and the
|
||||
.Nm
|
||||
will fail.
|
||||
will revert to the standard behavior.
|
||||
This problem can be corrected by creating a
|
||||
.Pa .snap
|
||||
directory in the root of the file system to be dumped;
|
||||
@ -271,7 +271,7 @@ The default tape length is 2300 feet.
|
||||
.It Fl T Ar date
|
||||
Use the specified date as the starting time for the dump
|
||||
instead of the time determined from looking in
|
||||
the
|
||||
a warning will be issued and the
|
||||
.Pa dumpdates
|
||||
file.
|
||||
The format of date is the same as that of
|
||||
|
@ -336,23 +336,34 @@ main(int argc, char *argv[])
|
||||
} else {
|
||||
char snapname[BUFSIZ], snapcmd[BUFSIZ];
|
||||
|
||||
snprintf(snapname, sizeof snapname,
|
||||
"%s/.snap/dump_snapshot", mntpt);
|
||||
snprintf(snapcmd, sizeof snapcmd, "%s %s %s",
|
||||
_PATH_MKSNAP_FFS, mntpt, snapname);
|
||||
unlink(snapname);
|
||||
if (system(snapcmd) != 0)
|
||||
errx(X_STARTUP, "Cannot create %s: %s\n",
|
||||
snapname, strerror(errno));
|
||||
if ((diskfd = open(snapname, O_RDONLY)) < 0) {
|
||||
snprintf(snapname, sizeof snapname, "%s/.snap", mntpt);
|
||||
if ((stat(snapname, &sb) < 0) || !S_ISDIR(sb.st_mode)) {
|
||||
msg("WARNING: %s %s\n",
|
||||
"-L requested but snapshot location",
|
||||
snapname);
|
||||
msg(" %s: %s\n",
|
||||
"is not a directory",
|
||||
"dump downgraded, -L ignored");
|
||||
snapdump = 0;
|
||||
} else {
|
||||
snprintf(snapname, sizeof snapname,
|
||||
"%s/.snap/dump_snapshot", mntpt);
|
||||
snprintf(snapcmd, sizeof snapcmd, "%s %s %s",
|
||||
_PATH_MKSNAP_FFS, mntpt, snapname);
|
||||
unlink(snapname);
|
||||
errx(X_STARTUP, "Cannot open %s: %s\n",
|
||||
snapname, strerror(errno));
|
||||
if (system(snapcmd) != 0)
|
||||
errx(X_STARTUP, "Cannot create %s: %s\n",
|
||||
snapname, strerror(errno));
|
||||
if ((diskfd = open(snapname, O_RDONLY)) < 0) {
|
||||
unlink(snapname);
|
||||
errx(X_STARTUP, "Cannot open %s: %s\n",
|
||||
snapname, strerror(errno));
|
||||
}
|
||||
unlink(snapname);
|
||||
if (fstat(diskfd, &sb) != 0)
|
||||
err(X_STARTUP, "%s: stat", snapname);
|
||||
spcl.c_date = _time_to_time64(sb.st_mtime);
|
||||
}
|
||||
unlink(snapname);
|
||||
if (fstat(diskfd, &sb) != 0)
|
||||
err(X_STARTUP, "%s: stat", snapname);
|
||||
spcl.c_date = _time_to_time64(sb.st_mtime);
|
||||
}
|
||||
} else if (snapdump != 0) {
|
||||
msg("WARNING: Cannot use -L on an unmounted filesystem.\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user