git: 2af5769e3431 - main - fdisk: Make confusing fdisk messages a little less ambiguous
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 11 Oct 2024 18:06:58 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=2af5769e3431f6b5d1bc0ddaac9082e53096e308
commit 2af5769e3431f6b5d1bc0ddaac9082e53096e308
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-10-11 16:13:08 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-10-11 18:06:33 +0000
fdisk: Make confusing fdisk messages a little less ambiguous
We print an error when we can't read the MBR. Add minimal messages about
continuing anyway.
PR: 167036
Sponsored by: Netflix
---
sbin/fdisk/fdisk.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c
index 6cfa2b510f22..d9514555ae34 100644
--- a/sbin/fdisk/fdisk.c
+++ b/sbin/fdisk/fdisk.c
@@ -380,7 +380,8 @@ main(int argc, char *argv[])
printf("******* Working on device %s *******\n",disk);
if (I_flag) {
- read_s0();
+ if (read_s0())
+ warnx("Ignoring bad existing MBR.");
reset_boot();
partp = &mboot.parts[0];
partp->dp_typ = DOSPTYP_386BSD;
@@ -410,8 +411,10 @@ main(int argc, char *argv[])
else
print_params();
- if (read_s0())
+ if (read_s0()) {
+ printf("Will replace existing bad MBR\n");
init_sector0(dos_sectors);
+ }
printf("Media sector size is %d\n", secsize);
printf("Warning: BIOS sector numbering starts with sector 1\n");