summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-07-24 02:42:34 +0000
committerbrian <brian@FreeBSD.org>1997-07-24 02:42:34 +0000
commit55aac7e4fffaeb14c711888f3baae4ebf54aea2a (patch)
treea5def5a28657f6e21eac78fe84da564219e5aadd
parent68126f0545f0f9b21238e8dea11e4a4893f19334 (diff)
downloadFreeBSD-src-55aac7e4fffaeb14c711888f3baae4ebf54aea2a.zip
FreeBSD-src-55aac7e4fffaeb14c711888f3baae4ebf54aea2a.tar.gz
Don't try to ioctl(,TIOCOUTQ,) on a closed
descriptor. Reported by: Stephane Raimbault <stephane@cybersurf.net>
-rw-r--r--usr.sbin/ppp/modem.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c
index 9345903..bee6ef3 100644
--- a/usr.sbin/ppp/modem.c
+++ b/usr.sbin/ppp/modem.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: modem.c,v 1.44 1997/06/23 23:10:13 brian Exp $
+ * $Id: modem.c,v 1.45 1997/07/14 01:41:29 brian Exp $
*
* TODO:
*/
@@ -788,10 +788,11 @@ ShowModemStatus()
fprintf(VarTerm, "fd = %d, modem control = %o\n", modem, mbits);
fprintf(VarTerm, "connect count: %d\n", connect_count);
#ifdef TIOCOUTQ
- if (ioctl(modem, TIOCOUTQ, &nb) > 0)
- fprintf(VarTerm, "outq: %d\n", nb);
- else
- fprintf(VarTerm, "outq: ioctl probe failed.\n");
+ if (modem >= 0)
+ if (ioctl(modem, TIOCOUTQ, &nb) > 0)
+ fprintf(VarTerm, "outq: %d\n", nb);
+ else
+ fprintf(VarTerm, "outq: ioctl probe failed: %s\n", strerror(errno));
#endif
fprintf(VarTerm, "outqlen: %d\n", ModemQlen());
fprintf(VarTerm, "DialScript = %s\n", VarDialScript);
OpenPOWER on IntegriCloud