git: 0f2b7181ea5a - main - bhyveload: If disk cannot be opened RW try RO. (=same as bhyve)

From: Poul-Henning Kamp <phk_at_FreeBSD.org>
Date: Tue, 17 Feb 2026 18:38:10 UTC
The branch main has been updated by phk:

URL: https://cgit.FreeBSD.org/src/commit/?id=0f2b7181ea5acbabe11bf2c732078e8898c02c40

commit 0f2b7181ea5acbabe11bf2c732078e8898c02c40
Author:     Poul-Henning Kamp <phk@FreeBSD.org>
AuthorDate: 2026-02-17 18:36:04 +0000
Commit:     Poul-Henning Kamp <phk@FreeBSD.org>
CommitDate: 2026-02-17 18:36:04 +0000

    bhyveload: If disk cannot be opened RW try RO. (=same as bhyve)
    
    Not expecting it to turn into yak-shaving: kevans
---
 usr.sbin/bhyveload/bhyveload.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/usr.sbin/bhyveload/bhyveload.c b/usr.sbin/bhyveload/bhyveload.c
index 5250e2120938..2b1bfec9a62d 100644
--- a/usr.sbin/bhyveload/bhyveload.c
+++ b/usr.sbin/bhyveload/bhyveload.c
@@ -722,6 +722,8 @@ disk_open(char *path)
 		return (ERANGE);
 
 	fd = open(path, O_RDWR);
+	if (fd < 0)
+		fd = open(path, O_RDONLY);
 	if (fd < 0)
 		return (errno);