[PATCH] cu/tip leaves tty in exclusive mode
Bruce M Simpson
bms at incunabulum.net
Tue Apr 29 01:51:00 UTC 2008
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
-------------- next part --------------
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));
}
More information about the freebsd-current
mailing list