summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-03-10 06:54:58 +0000
committerache <ache@FreeBSD.org>1997-03-10 06:54:58 +0000
commit8a8c723f8ea12237e946071c773a4799b9c7ff96 (patch)
tree30988f9b88217288acf163b9c70ed1d3a640ddab /usr.sbin
parent075d27ba8ebaed8a7e378297085b1b0bdc44dcd9 (diff)
downloadFreeBSD-src-8a8c723f8ea12237e946071c773a4799b9c7ff96.zip
FreeBSD-src-8a8c723f8ea12237e946071c773a4799b9c7ff96.tar.gz
Detect failure open condition for direct mode now
Don't assume that modem descriptor must be >=3 in CloseModem, just assume it is any valid descriptor >=0
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/modem.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c
index a92d3dc..e791776 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.29 1997/02/22 16:10:36 peter Exp $
+ * $Id: modem.c,v 1.30 1997/03/10 06:21:02 ache Exp $
*
* TODO:
*/
@@ -380,8 +380,14 @@ int mode;
mbits = 0;
if (mode & MODE_DIRECT) {
- if (isatty(0))
+ if (isatty(0)) {
modem = open(ctermid(NULL), O_RDWR|O_NONBLOCK);
+ if (modem < 0) {
+ LogPrintf(LOG_PHASE_BIT, "Open Failed %s\n", ctermid(NULL));
+ return(modem);
+ }
+ } else if (modem < 0)
+ return(modem);
} else if (modem < 0) {
if (strncmp(VarDevice, "/dev", 4) == 0) {
strncpy(uucplock, rindex(VarDevice, '/')+1,sizeof(uucplock)-1);
@@ -609,7 +615,7 @@ int flag;
void
CloseModem()
{
- if (modem >= 3)
+ if (modem >= 0)
{
close(modem);
modem = -1;
OpenPOWER on IntegriCloud