init: fix for FreeBSD console opening. Closes 9031

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/init/init.c b/init/init.c
index 6eb76b8..0813d1b 100644
--- a/init/init.c
+++ b/init/init.c
@@ -297,6 +297,11 @@
 	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) {