summaryrefslogtreecommitdiffhomepage
path: root/init
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-08-22 20:56:58 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-08-22 20:56:58 +0200
commitd035528261eb9304e9e448c7d8847095b8e8c7c5 (patch)
tree5eb6d912502e7f8f3fcd82bda96fdf6dbc1991a7 /init
parent2cf9fa6e597d0706b66e0c01f02b486fd0c9f77d (diff)
init: fix for FreeBSD console opening. Closes 9031
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'init')
-rw-r--r--init/init.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/init/init.c b/init/init.c
index 6eb76b80e..0813d1b5f 100644
--- a/init/init.c
+++ b/init/init.c
@@ -297,6 +297,11 @@ static void console_init(void)
s = getenv("CONSOLE");
if (!s)
s = getenv("console");
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+ /* BSD people say their kernels do not open fd 0,1,2; they need this: */
+ if (!s)
+ s = (char*)"/dev/console";
+#endif
if (s) {
int fd = open(s, O_RDWR | O_NONBLOCK | O_NOCTTY);
if (fd >= 0) {