Give a sensible error message when the filesystem to be dumped is

not listed in /etc/fstab. Previously, the user would be greeted
with "DUMP: bad sblock magic number" when dump tried to parse
the directory contents as an FFS filesystem.

PR:		bin/12789
Submitted by:	Bob Willcox <bob@pmr.com>
This commit is contained in:
Ian Dowse 2001-11-16 22:13:44 +00:00
parent 7b9716bad2
commit a50e99d137
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=86470

View File

@ -97,6 +97,7 @@ main(argc, argv)
int argc;
char *argv[];
{
struct stat sb;
register ino_t ino;
register int dirty;
register struct dinode *dp;
@ -336,10 +337,12 @@ main(argc, argv)
else
msgtail("to %s\n", tape);
if ((diskfd = open(disk, O_RDONLY)) < 0) {
msg("Cannot open %s\n", disk);
exit(X_STARTUP);
}
if ((diskfd = open(disk, O_RDONLY)) < 0)
err(X_STARTUP, "Cannot open %s", disk);
if (fstat(diskfd, &sb) != 0)
err(X_STARTUP, "%s: stat", disk);
if (S_ISDIR(sb.st_mode))
errx(X_STARTUP, "%s: unknown file system", disk);
sync();
sblock = (struct fs *)sblock_buf;
bread(SBOFF, (char *) sblock, SBSIZE);