mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-01 00:18:15 +01:00
Only Mount relative to Written disklabel.
This commit is contained in:
parent
ae7d223f92
commit
c4f1695923
@ -568,6 +568,10 @@ DiskLabel()
|
||||
break;
|
||||
|
||||
case 'm': case 'M':
|
||||
if (memcmp(lbl, Dlbl[diskno], sizeof *lbl)) {
|
||||
yip = "Please (W)rite changed partition information first";
|
||||
break;
|
||||
}
|
||||
j = AskWhichPartition("Mountpoint of which partition ? ");
|
||||
if (j < 0) {
|
||||
yip = "Invalid partition";
|
||||
@ -606,17 +610,13 @@ DiskLabel()
|
||||
Dlbl[diskno]->d_magic2 = DISKMAGIC;
|
||||
Dlbl[diskno]->d_checksum = 0;
|
||||
Dlbl[diskno]->d_checksum = dkcksum(Dlbl[diskno]);
|
||||
*lbl= *Dlbl[diskno];
|
||||
flag=1;
|
||||
if (ioctl(Dfd[diskno], DIOCWLABEL, &flag) < 0)
|
||||
Fatal("Couldn't enable writing of labels");
|
||||
*lbl = *Dlbl[diskno];
|
||||
enable_label(Dfd[diskno]);
|
||||
if (ioctl(Dfd[diskno], DIOCSDINFO, Dlbl[diskno]) == -1)
|
||||
Fatal("Couldn't set label: %s", strerror(errno));
|
||||
if (ioctl(Dfd[diskno], DIOCWDINFO, Dlbl[diskno]) == -1)
|
||||
Fatal("Couldn't write label: %s", strerror(errno));
|
||||
flag=0;
|
||||
if (ioctl(Dfd[diskno], DIOCWLABEL, &flag) < 0)
|
||||
Fatal("Couldn't disable writing of labels");
|
||||
disable_label(Dfd[diskno]);
|
||||
yip = "Label written successfully.";
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user