summaryrefslogtreecommitdiff
path: root/sbin/fdisk
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1997-09-30 00:02:55 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1997-09-30 00:02:55 +0000
commitb81549f7f5c3ba7e02ae10ebfb0a668439c0dfa5 (patch)
treeca1108fc3c19e089e79be862d58c13e3c177934d /sbin/fdisk
parent728e8a997b77843af12dc272ed12d3511d7111b5 (diff)
ask permission to write new MBR
Diffstat (limited to 'sbin/fdisk')
-rw-r--r--sbin/fdisk/user.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/sbin/fdisk/user.c b/sbin/fdisk/user.c
index 5277f7f29c2..5c15af64893 100644
--- a/sbin/fdisk/user.c
+++ b/sbin/fdisk/user.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: user.c,v 1.3 1997/09/29 23:33:40 mickey Exp $ */
+/* $OpenBSD: user.c,v 1.4 1997/09/30 00:02:54 mickey Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -94,10 +94,17 @@ USER_init(disk, tt)
PRT_fix_BN(disk, &tt->part[3]);
/* Write sector 0 */
- fd = DISK_open(disk->name, O_RDWR);
- MBR_make(tt, mbr_buf);
- MBR_write(fd, (off_t)0, mbr_buf);
- DISK_close(fd);
+ printf("\a\n"
+ "\t-----------------------------------------------------\n"
+ "\t------ ATTENTION - UPDATING MASTER BOOT RECORD ------\n"
+ "\t-----------------------------------------------------\n");
+ if(ask_yn("\nDo you wish to write new MBR?")){
+ fd = DISK_open(disk->name, O_RDWR);
+ MBR_make(tt, mbr_buf);
+ MBR_write(fd, (off_t)0, mbr_buf);
+ DISK_close(fd);
+ } else
+ printf("MBR is unchanged\n");
return(0);
}
@@ -156,8 +163,7 @@ USER_modify(disk, tt, offset)
if(st == CMD_DIRTY) modified = 1;
} while(1);
-
- /* XXX - Write out MBR */
+ /* Write out MBR */
if(modified){
printf("\a\n"
"\t-----------------------------------------------------\n"