Date: Tue, 29 Apr 2008 02:35:46 +0100 From: Bruce M Simpson <bms@incunabulum.net> To: FreeBSD Current <freebsd-current@freebsd.org> Subject: [PATCH] cu/tip leaves tty in exclusive mode Message-ID: <48167B72.1000207@incunabulum.net>
next in thread | raw e-mail | index | archive | help
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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48167B72.1000207>