mirror of
https://github.com/sheumann/hush.git
synced 2024-10-27 07:28:31 +00:00
init: test for vt terminal with VT_OPENQRY,
assume that anything else is TERM=vt102, not TERM=linux. (Serial console test is less correct) Tentatively closes bug 195. function old new delta init_main 946 919 -27
This commit is contained in:
parent
5c2b81470d
commit
5981ba5843
32
init/init.c
32
init/init.c
@ -14,6 +14,7 @@
|
|||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
#include <sys/reboot.h>
|
#include <sys/reboot.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
#include <linux/vt.h>
|
||||||
|
|
||||||
|
|
||||||
/* Was a CONFIG_xxx option. A lot of people were building
|
/* Was a CONFIG_xxx option. A lot of people were building
|
||||||
@ -161,33 +162,9 @@ static void message(int where, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* From <linux/serial.h> */
|
|
||||||
struct serial_struct {
|
|
||||||
int type;
|
|
||||||
int line;
|
|
||||||
unsigned int port;
|
|
||||||
int irq;
|
|
||||||
int flags;
|
|
||||||
int xmit_fifo_size;
|
|
||||||
int custom_divisor;
|
|
||||||
int baud_base;
|
|
||||||
unsigned short close_delay;
|
|
||||||
char io_type;
|
|
||||||
char reserved_char[1];
|
|
||||||
int hub6;
|
|
||||||
unsigned short closing_wait; /* time to wait before closing */
|
|
||||||
unsigned short closing_wait2; /* no longer used... */
|
|
||||||
unsigned char *iomem_base;
|
|
||||||
unsigned short iomem_reg_shift;
|
|
||||||
unsigned int port_high;
|
|
||||||
unsigned long iomap_base; /* cookie passed into ioremap */
|
|
||||||
int reserved[1];
|
|
||||||
/* Paranoia (imagine 64bit kernel overwriting 32bit userspace stack) */
|
|
||||||
uint32_t bbox_reserved[16];
|
|
||||||
};
|
|
||||||
static void console_init(void)
|
static void console_init(void)
|
||||||
{
|
{
|
||||||
struct serial_struct sr;
|
int vtno;
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
s = getenv("CONSOLE");
|
s = getenv("CONSOLE");
|
||||||
@ -211,8 +188,9 @@ static void console_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
s = getenv("TERM");
|
s = getenv("TERM");
|
||||||
if (ioctl(STDIN_FILENO, TIOCGSERIAL, &sr) == 0) {
|
if (ioctl(STDIN_FILENO, VT_OPENQRY, &vtno) != 0) {
|
||||||
/* Force the TERM setting to vt102 for serial console
|
/* Not a linux terminal, probably serial console.
|
||||||
|
* Force the TERM setting to vt102
|
||||||
* if TERM is set to linux (the default) */
|
* if TERM is set to linux (the default) */
|
||||||
if (!s || strcmp(s, "linux") == 0)
|
if (!s || strcmp(s, "linux") == 0)
|
||||||
putenv((char*)"TERM=vt102");
|
putenv((char*)"TERM=vt102");
|
||||||
|
Loading…
Reference in New Issue
Block a user