Always say the magic word at the end.

This commit is contained in:
Poul-Henning Kamp 1994-11-08 10:14:19 +00:00
parent d32d339dc6
commit 46c134684c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=4267

View File

@ -67,23 +67,21 @@ void
write_dospart(int fd, struct dos_partition *dp)
{
u_char buf[512];
int flag;
if (lseek(fd, 0, SEEK_SET) == -1)
AskAbort("Couldn't seek for master boot record read\n");
if (read(fd, buf, 512) != 512) {
AskAbort("Failed to read master boot record\n");
}
memcpy(buf+DOSPARTOFF, dp, sizeof(*dp)*NDOSPART);
buf[510] = 0x55;
buf[511] = 0xaa;
if (lseek(fd, 0, SEEK_SET) == -1)
AskAbort("Couldn't seek for master boot record read\n");
flag=1;
if (ioctl(fd, DIOCWLABEL, &flag) < 0)
AskAbort("Couldn't enable writing of labels");
AskAbort("Couldn't seek for master boot record write\n");
enable_label(fd);
if (write(fd, buf, 512) != 512)
AskAbort("Failed to write master boot record\n");
flag=0;
if (ioctl(fd, DIOCWLABEL, &flag) < 0)
AskAbort("Couldn't disable writing of labels");
disable_label(fd);
}
int