From owner-freebsd-current@FreeBSD.ORG Tue Apr 29 01:50:59 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE09E106566C for ; Tue, 29 Apr 2008 01:50:59 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com [66.111.4.28]) by mx1.freebsd.org (Postfix) with ESMTP id A17AE8FC19 for ; Tue, 29 Apr 2008 01:50:59 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id 9317C1049D7 for ; Mon, 28 Apr 2008 21:35:48 -0400 (EDT) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute2.internal (MEProxy); Mon, 28 Apr 2008 21:35:48 -0400 X-Sasl-enc: ZXrBJJ85NHw0G7m5cvQnVZTEsERMup62ekayTo5tdfgv 1209432948 Received: from empiric.lon.incunabulum.net (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id 24C276359 for ; Mon, 28 Apr 2008 21:35:48 -0400 (EDT) Message-ID: <48167B72.1000207@incunabulum.net> Date: Tue, 29 Apr 2008 02:35:46 +0100 From: Bruce M Simpson User-Agent: Thunderbird 2.0.0.12 (X11/20080423) MIME-Version: 1.0 To: FreeBSD Current X-Enigmail-Version: 0.95.6 Content-Type: multipart/mixed; boundary="------------050300000900030307060504" Subject: [PATCH] cu/tip leaves tty in exclusive mode X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Apr 2008 01:51:00 -0000 This is a multi-part message in MIME format. --------------050300000900030307060504 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, I think I saw a bug. I have an app which creates ptys on its own. I connect to them manually with cu -l. It appears that cu doesn't clean up after itself... this is a quick fix BMS --------------050300000900030307060504 Content-Type: text/plain; name="tip-excl.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="tip-excl.diff" diff -urN /usr/src/usr.bin/tip/tip/cmds.c tip/cmds.c --- /usr/src/usr.bin/tip/tip/cmds.c 2003-04-06 09:30:25.000000000 +0100 +++ tip/cmds.c 2008-04-29 02:31:28.000000000 +0100 @@ -662,6 +662,7 @@ daemon_uid(); (void)uu_unlock(uucplock); unraw(); + unexcl(); exit(0); } diff -urN /usr/src/usr.bin/tip/tip/tip.c tip/tip.c --- /usr/src/usr.bin/tip/tip/tip.c 2003-04-06 09:30:25.000000000 +0100 +++ tip/tip.c 2008-04-29 02:28:23.000000000 +0100 @@ -322,6 +322,15 @@ tcsetattr(0, TCSADRAIN, &defterm); } +/* + * give up exclusive tty access + */ +void +unexcl() +{ + ioctl(FD, TIOCNXCL, 0); +} + static jmp_buf promptbuf; /* diff -urN /usr/src/usr.bin/tip/tip/tip.h tip/tip.h --- /usr/src/usr.bin/tip/tip/tip.h 2004-05-06 14:25:09.000000000 +0100 +++ tip/tip.h 2008-04-29 02:28:37.000000000 +0100 @@ -308,6 +308,7 @@ void transfer(char *buf, int fd, char *eofchars); void transmit(FILE *fd, char *eofchars, char *command); void ttysetup(int _speed); +void unexcl(void); void unraw(void); void user_uid(void); void vinit(void); diff -urN /usr/src/usr.bin/tip/tip/uucplock.c tip/uucplock.c --- /usr/src/usr.bin/tip/tip/uucplock.c 2001-12-20 14:25:46.000000000 +0000 +++ tip/uucplock.c 2008-04-29 02:32:44.000000000 +0100 @@ -131,5 +131,6 @@ char tbuf[sizeof(_PATH_LOCKDIRNAME) + MAXNAMLEN]; (void)snprintf(tbuf, sizeof tbuf, _PATH_LOCKDIRNAME, ttyname); + unexcl(); return(unlink(tbuf)); } --------------050300000900030307060504--