Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Nov 2000 19:00:20 -0800
From:      "John W. De Boskey" <jwd@FreeBSD.org>
To:        Current List <freebsd-current@FreeBSD.org>
Subject:   getty bug when run by hand
Message-ID:  <20001113190020.A98362@FreeBSD.org>

next in thread | raw e-mail | index | archive | help

Hi,

   I've been working on serial ports/consoles the last few days
and have run into what I consider a bug in getty (-current)..

   When the following command is run as root:

/usr/obj/usr/src/libexec/getty/getty std.38400 ttyd1


   the call to login_tty() fails in the opentty() function:

        else {
                login_tty(i);
                return 1;
        }

   However, the return code is not checked. File descripters 0,
1, and 2 are not modified to point at ttyd1, and the getty then
proceeds to run on the current terminal session.

   At a minimum, I'd like to commit the following patch. It would
have helped avoid some frustrating moments...

===================================================================
RCS file: /home/ncvs/src/libexec/getty/main.c,v
retrieving revision 1.31
diff -u -r1.31 main.c
--- main.c      2000/10/10 01:53:00     1.31
+++ main.c      2000/11/14 02:25:31
@@ -444,7 +444,10 @@
                return 0;
        }
        else {
-               login_tty(i);
+               if (login_tty(i) < 0) {
+                       syslog(LOG_ERR, "login_tty %s: %m", ttyn);
+                       return 0;
+               }
                return 1;
        }
 }



   This of course then leads to the question of why the 
TIOCSCTTY ioctl call failes. From the above change:

Nov 13 17:25:47 mail getty[1236]: login_tty /dev/ttyd1: Operation not
permitted

   It's worth noting that /dev/ttyd1 has been successfully openned
on fd 3 this point. The serial ports work fine with tip or kermit
and from dmesg are:

sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0
sio0: type 16550A
sio1 at port 0x2f8-0x2ff irq 3 on isa0
sio1: type 16550A


   comments welcome.

-John

   


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001113190020.A98362>