From clement@freesbee.fr  Tue Apr 24 06:30:03 2001
Return-Path: <clement@freesbee.fr>
Received: from sanga.paris.none.net (nat133.libertysurfpro.net [212.129.0.133])
	by hub.freebsd.org (Postfix) with ESMTP id 77CEC37B43E
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 24 Apr 2001 06:30:01 -0700 (PDT)
	(envelope-from clement@freesbee.fr)
Received: from polom.mouarf.org ([212.129.8.240]) by nil.paris.none.net
          (InterMail vM.4.01.02.17 201-229-119) with ESMTP
          id <20010424132846.NRBX6451.nil.paris.none.net@polom.mouarf.org>
          for <FreeBSD-gnats-submit@freebsd.org>;
          Tue, 24 Apr 2001 15:28:46 +0200
Received: (from clement@localhost)
	by polom.mouarf.org (8.11.3/8.11.3) id f3OESm601342;
	Tue, 24 Apr 2001 16:28:48 +0200 (CEST)
	(envelope-from clement)
Message-Id: <200104241428.f3OESm601342@polom.mouarf.org>
Date: Tue, 24 Apr 2001 16:28:48 +0200 (CEST)
From: clement@asso.ups-tlse.fr
Reply-To: clement@asso.ups-tlse.fr
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] isdnd in fullscreen-mode fails to detect read error from tty
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         26817
>Category:       bin
>Synopsis:       isdnd in fullscreen-mode fails to detect read error from tty
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    hm
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 24 06:40:01 PDT 2001
>Closed-Date:    Tue Jun 5 08:17:30 PDT 2001
>Last-Modified:  Tue Jun 05 08:18:25 PDT 2001
>Originator:     Clement Ballabriga
>Release:        FreeBSD 4.3-STABLE i386
>Organization:
none
>Environment:
System: FreeBSD polom.mouarf.org 4.3-STABLE FreeBSD 4.3-STABLE #0: Sat Apr 21 21:25:21 CEST 2001 root@polom.mouarf.org:/usr/src/sys/compile/POLOM i386

>Description:
	isdnd, when running in full-screen mode, fails to detect read errors fro
m its controlling tty (for exemple when the tty has been revoke()'d). It happens
 in a loop with a select() in it. The tty is in the read fd_set, and, when the 
tty's fd is no longer readable, isdnd fails to detect it and keep this fd in the
 read fd_set, causing select() to return immediately each time, and making isdnd
 use all CPU resources.

Because of the default value of isdn_fsdev in /etc/defaults/rc.conf, isdnd is 
launched by default in full-screen mode, on terminal /dev/ttyv4. getty(8) uses 
this console, so when getty is started, isdnd can no longer read /dev/ttyv4, 
and the problem described above happens.

>How-To-Repeat:
	Configure isdn in kernel and isdnd, put isdn_enable in /etc/rc.conf.
Do not change the default value for isdn_fsdev, and reboot.

>Fix:
	Here is a patch for isdnd. If it can't read from its controlling termina
l, it puts an error in the log file and exits.(the patch is for the file main.c of isdnd, src/usr.sbin/i4b/isdnd/main.c)


--- main.c.old	Sun Apr 22 23:33:37 2001
+++ main.c	Sun Apr 22 23:37:25 2001
@@ -610,6 +610,12 @@
 {
 	int ch = getch();
 		
+	if (ch == ERR)
+	{
+		log(LL_ERR, "kbdrdhdl: ERROR, read error on controlling tty, errno = %d!", errno);
+		error_exit(1, "kbdrdhdl: ERROR, read error on controlling tty, errno = %d!", errno);
+	}
+	
 	switch(ch)
 	{
 		case 0x0c:	/* control L */
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->hm 
Responsible-Changed-By: hm 
Responsible-Changed-When: Thu May 24 04:20:12 PDT 2001 
Responsible-Changed-Why:  
change to maintainer 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=26817 
State-Changed-From-To: open->closed 
State-Changed-By: hm 
State-Changed-When: Tue Jun 5 08:17:30 PDT 2001 
State-Changed-Why:  
Fix has been committed to -current. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=26817 
>Unformatted:
