git: 5a023bd2a53a - main - bhyveload: open guest boot disk image O_RDWR

From: Robert Wing <rew_at_FreeBSD.org>
Date: Mon, 05 Dec 2022 17:23:26 UTC
The branch main has been updated by rew:

URL: https://cgit.FreeBSD.org/src/commit/?id=5a023bd2a53a7279b126ae6bf949560c6342b57a

commit 5a023bd2a53a7279b126ae6bf949560c6342b57a
Author:     Robert Wing <rew@FreeBSD.org>
AuthorDate: 2022-12-05 17:22:45 +0000
Commit:     Robert Wing <rew@FreeBSD.org>
CommitDate: 2022-12-05 17:22:45 +0000

    bhyveload: open guest boot disk image O_RDWR
    
    When a boot environment has been booted via the bootonce feature,
    userboot clears the bootonce value from an nvlist but fails to write the
    updated nvlist back to disk.
    
    The failure occurs because bhyveload opens the guest boot disk image
    O_RDONLY, fix this by opening it O_RDWR.
    
    Reviewed by:    imp, markj, jhb
    Differential Revision:  https://reviews.freebsd.org/D37274
---
 usr.sbin/bhyveload/bhyveload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr.sbin/bhyveload/bhyveload.c b/usr.sbin/bhyveload/bhyveload.c
index db7d995f2466..1a24b5f0044a 100644
--- a/usr.sbin/bhyveload/bhyveload.c
+++ b/usr.sbin/bhyveload/bhyveload.c
@@ -690,7 +690,7 @@ disk_open(char *path)
 	if (ndisks >= NDISKS)
 		return (ERANGE);
 
-	fd = open(path, O_RDONLY);
+	fd = open(path, O_RDWR);
 	if (fd < 0)
 		return (errno);