If dsgetlabel() returns a label with a size of zero in diskdumpconf(),

treat it as an invalid partition.

This fixes a bug where ``dumpon <device>'' will configure the dump
device at a random offset on the disk if <device> isn't a valid
partition.

Reviewed by: phk
This commit is contained in:
Brian Somers 2002-10-05 11:24:21 +00:00
parent 4b96f22259
commit 52ae0b7fb5

View File

@ -221,6 +221,8 @@ diskdumpconf(u_int onoff, dev_t dev, struct disk *dp)
dp->d_slice->dss_slices[dkslice(dev)].ds_offset) * DEV_BSIZE;
di.mediasize =
(off_t)(dl->d_partitions[dkpart(dev)].p_size) * DEV_BSIZE;
if (di.mediasize == 0)
return (EINVAL);
return(set_dumper(&di));
}