aboutsummaryrefslogtreecommitdiffstats
path: root/src/console_check.c
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2008-03-19 12:55:14 -0400
committerBill Nottingham <notting@redhat.com>2008-03-19 12:55:14 -0400
commitf892674d525dde82da15ff1beb38e8e1e448e1d1 (patch)
tree972f0798e785af2777f9ca9b4d9a973186859029 /src/console_check.c
parentacc9ccb42dec902eee87fc906552056a1ebd334b (diff)
downloadinitscripts-f892674d525dde82da15ff1beb38e8e1e448e1d1.tar
initscripts-f892674d525dde82da15ff1beb38e8e1e448e1d1.tar.gz
initscripts-f892674d525dde82da15ff1beb38e8e1e448e1d1.tar.bz2
initscripts-f892674d525dde82da15ff1beb38e8e1e448e1d1.tar.xz
initscripts-f892674d525dde82da15ff1beb38e8e1e448e1d1.zip
always open with NONBLOCK, clear the serial structs first (<dwmw2@infradead.org>)
Diffstat (limited to 'src/console_check.c')
-rw-r--r--src/console_check.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/console_check.c b/src/console_check.c
index 243e9be5..60dc89e2 100644
--- a/src/console_check.c
+++ b/src/console_check.c
@@ -79,7 +79,7 @@ int compare_termios_to_console(char *dev, int *speed) {
tcgetattr(cfd, &cmode);
close(cfd);
- fd = open(dev, O_RDONLY);
+ fd = open(dev, O_RDONLY|O_NONBLOCK);
tcgetattr(fd, &mode);
if (!termcmp(&cmode, &mode)) {
@@ -97,6 +97,9 @@ char *check_serial_console(int *speed) {
char twelve = 12;
struct serial_struct si, si2;
+ memset(&si, 0, sizeof(si));
+ memset(&si2, 0, sizeof(si));
+
fd = open("/dev/console", O_RDWR);
if (ioctl (fd, TIOCLINUX, &twelve) >= 0)
goto out;