From f7c7b87fbd1c02016aa310f5d3866382cb38dc40 Mon Sep 17 00:00:00 2001 From: Brian Feldman Date: Mon, 12 Apr 2004 20:19:32 +0000 Subject: [PATCH] Improve the warnings for dump -L and do not bother doing the snapshot if it is specified for read-only filesystems. Submitted by: Jason Young PR: 46672 --- sbin/dump/dump.8 | 1 + sbin/dump/main.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sbin/dump/dump.8 b/sbin/dump/dump.8 index 2abb59493892..0e86ebed8434 100644 --- a/sbin/dump/dump.8 +++ b/sbin/dump/dump.8 @@ -211,6 +211,7 @@ takes a snapshot of the file system in the directory in the root of the filesystem being dumped and then does a dump of the snapshot. The snapshot is removed when the dump is complete. +This option is ignored for unmounted or read-only filesystems. If the .Pa .snap directory does not exist in the root of the filesystem being dumped, diff --git a/sbin/dump/main.c b/sbin/dump/main.c index c6beb2a2d3b5..baf8a250a898 100644 --- a/sbin/dump/main.c +++ b/sbin/dump/main.c @@ -309,9 +309,16 @@ main(int argc, char *argv[]) spcl.c_filesys[NAMELEN-1]='\0'; if ((mntpt = getmntpt(disk, &mntflags)) != 0) { - if (snapdump == 0) { - msg("WARNING: %s\n", - "should use -L when dumping live filesystems!"); + if (mntflags & MNT_RDONLY) { + if (snapdump != 0) { + msg("WARNING: %s\n", + "-L ignored for read-only filesystem."); + snapdump = 0; + } + } else if (snapdump == 0) { + msg("WARNING: %s%s\n", + "should use -L when dumping live read-write ", + "filesystems!"); } else { char snapname[BUFSIZ], snapcmd[BUFSIZ];