diff options
author | 2000-10-24 21:52:37 +0000 | |
---|---|---|
committer | 2000-10-24 21:52:37 +0000 | |
commit | d11e2fa7c572ac039cc549054e1d07910ada27b6 (patch) | |
tree | 21f681c518cc9bff4bb99c38b1f6cd1083f8f3fe | |
parent | Add the punchline to the procedure for making web server certificates (diff) | |
download | wireguard-openbsd-d11e2fa7c572ac039cc549054e1d07910ada27b6.tar.xz wireguard-openbsd-d11e2fa7c572ac039cc549054e1d07910ada27b6.zip |
When calling setupterm() pass in an int* for the error code so
it doesn't spew to stderr if the terminal type can't be found.
Fix a logic thinko wrt terminaltypeok() -- it should return 0 on failure,
not success.
-rw-r--r-- | libexec/telnetd/telnetd.c | 9 | ||||
-rw-r--r-- | usr.bin/telnet/telnet.c | 5 |
2 files changed, 8 insertions, 6 deletions
diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c index bc90a8442d7..0593ea79322 100644 --- a/libexec/telnetd/telnetd.c +++ b/libexec/telnetd/telnetd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: telnetd.c,v 1.25 2000/10/10 15:14:55 millert Exp $ */ +/* $OpenBSD: telnetd.c,v 1.26 2000/10/24 21:52:37 millert Exp $ */ /* $NetBSD: telnetd.c,v 1.6 1996/03/20 04:25:57 tls Exp $ */ /* @@ -45,7 +45,7 @@ static char copyright[] = static char sccsid[] = "@(#)telnetd.c 8.4 (Berkeley) 5/30/95"; static char rcsid[] = "$NetBSD: telnetd.c,v 1.5 1996/02/28 20:38:23 thorpej Exp $"; #else -static char rcsid[] = "$OpenBSD: telnetd.c,v 1.25 2000/10/10 15:14:55 millert Exp $"; +static char rcsid[] = "$OpenBSD: telnetd.c,v 1.26 2000/10/24 21:52:37 millert Exp $"; #endif #endif /* not lint */ @@ -764,6 +764,7 @@ _gettermname() terminaltypeok(s) char *s; { + int errret; if (terminaltype == NULL) return(1); @@ -771,9 +772,9 @@ terminaltypeok(s) /* * setupterm() will return OK if the type is known, and * ERR if it is not known. - * We return 0 on success and 1 on failure. + * We return 1 on success and 0 on failure. */ - return(setupterm(s, STDOUT_FILENO, NULL) == ERR); + return(setupterm(s, STDOUT_FILENO, &errret) != ERR); } #ifndef MAXHOSTNAMELEN diff --git a/usr.bin/telnet/telnet.c b/usr.bin/telnet/telnet.c index fc0e69114e2..dc0a1e79a7a 100644 --- a/usr.bin/telnet/telnet.c +++ b/usr.bin/telnet/telnet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: telnet.c,v 1.9 2000/10/10 15:41:11 millert Exp $ */ +/* $OpenBSD: telnet.c,v 1.10 2000/10/24 21:52:38 millert Exp $ */ /* $NetBSD: telnet.c,v 1.7 1996/02/28 21:04:15 thorpej Exp $ */ /* @@ -677,13 +677,14 @@ gettermname() char *tname; static char **tnamep = 0; static char **next; + int errret; if (resettermname) { resettermname = 0; if (tnamep && tnamep != unknown) free(tnamep); if ((tname = (char *)env_getvalue((unsigned char *)"TERM")) && - (setupterm(tname, 1, NULL) == OK)) { + (setupterm(tname, 1, &errret) == OK)) { tnamep = mklist(ttytype, tname); } else { if (tname && ((int)strlen(tname) <= 40)) { |