summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-07-25 16:40:23 -0400
committerJune McEnroe <june@causal.agency>2018-07-25 16:40:23 -0400
commit125630aeab8e576bdd87c5a66ea18d8b3f583797 (patch)
tree4d2d7d3c0397f0cd7a40842dc4efd61c7fff03ae /bin
parentRemove nasm from install (diff)
downloadsrc-125630aeab8e576bdd87c5a66ea18d8b3f583797.tar.gz
src-125630aeab8e576bdd87c5a66ea18d8b3f583797.zip
Fix cfmakeraw calls
It turns out that you're supposed to call cfmakeraw with a termios
initialized by tcgetattr. Using an uninitialized termios resulted in
hnel on NetBSD breaking the pty and causing a silent logout.
Diffstat (limited to 'bin')
-rw-r--r--bin/dtch.c2
-rw-r--r--bin/hnel.c2
-rw-r--r--bin/modem.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/bin/dtch.c b/bin/dtch.c
index 61bf2378..a0cd2899 100644
--- a/bin/dtch.c
+++ b/bin/dtch.c
@@ -206,7 +206,7 @@ static int atch(int argc, char *argv[]) {
 	if (error) err(EX_IOERR, "tcgetattr");
 	atexit(restoreTerm);
 
-	struct termios raw;
+	struct termios raw = saveTerm;
 	cfmakeraw(&raw);
 	error = tcsetattr(STDIN_FILENO, TCSADRAIN, &raw);
 	if (error) err(EX_IOERR, "tcsetattr");
diff --git a/bin/hnel.c b/bin/hnel.c
index 20dbd2a7..50ad6bf7 100644
--- a/bin/hnel.c
+++ b/bin/hnel.c
@@ -53,7 +53,7 @@ int main(int argc, char *argv[]) {
 	if (error) err(EX_IOERR, "tcgetattr");
 	atexit(restoreTerm);
 
-	struct termios raw;
+	struct termios raw = saveTerm;
 	cfmakeraw(&raw);
 	error = tcsetattr(STDERR_FILENO, TCSADRAIN, &raw);
 	if (error) err(EX_IOERR, "tcsetattr");
diff --git a/bin/modem.c b/bin/modem.c
index c099119a..c8074a9a 100644
--- a/bin/modem.c
+++ b/bin/modem.c
@@ -47,7 +47,7 @@ int main(int argc, char *argv[]) {
 	if (error) err(EX_IOERR, "tcgetattr");
 	atexit(restoreTerm);
 
-	struct termios raw;
+	struct termios raw = saveTerm;
 	cfmakeraw(&raw);
 	error = tcsetattr(STDIN_FILENO, TCSADRAIN, &raw);
 	if (error) err(EX_IOERR, "tcsetattr");