git: 4c46d1aac783 - stable/14 - bhyveload: do not hang on EOF from console input
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 03 Oct 2026 12:20:50 UTC
The branch stable/14 has been updated by novel:
URL: https://cgit.FreeBSD.org/src/commit/?id=4c46d1aac7831da0c31b10d99dfd0780b1972ab9
commit 4c46d1aac7831da0c31b10d99dfd0780b1972ab9
Author: Roman Bogorodskiy <novel@FreeBSD.org>
AuthorDate: 2026-08-27 17:40:43 +0000
Commit: Roman Bogorodskiy <novel@FreeBSD.org>
CommitDate: 2026-10-03 10:54:53 +0000
bhyveload: do not hang on EOF from console input
Currently, when bhyveload(8) fails to boot the guest,
it drops into the loader prompt waiting for user input.
This behaviour is inconvenient when using bhyveload(8) from
scripts.
Make it exit when it receives EOF from console input.
PR: 286289
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D59226
(cherry picked from commit 8c20260bc55d7b4be0cbcf0a940505ae15ab41a9)
---
usr.sbin/bhyveload/bhyveload.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/usr.sbin/bhyveload/bhyveload.c b/usr.sbin/bhyveload/bhyveload.c
index be99bb342de6..3ee5f7ac7129 100644
--- a/usr.sbin/bhyveload/bhyveload.c
+++ b/usr.sbin/bhyveload/bhyveload.c
@@ -134,8 +134,12 @@ static int
cb_getc(void *arg __unused)
{
char c;
+ ssize_t nread;
- if (read(consin_fd, &c, 1) == 1)
+ nread = read(consin_fd, &c, 1);
+ if (nread == 0)
+ cb_exit(NULL, USERBOOT_EXIT_QUIT);
+ if (nread == 1)
return (c);
return (-1);
}