diff options
author | brian <brian@FreeBSD.org> | 1997-03-31 22:51:00 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-03-31 22:51:00 +0000 |
commit | cb7f5ad55578fad7245152f0f9b7647830a53a2b (patch) | |
tree | 2c78d1ecaf1cdd58a514ff6e9ba36cc4bc7becdf /usr.sbin/ppp | |
parent | 8871c2899e1277da4a3d19c3cbbc4d2fae060306 (diff) | |
download | FreeBSD-src-cb7f5ad55578fad7245152f0f9b7647830a53a2b.zip FreeBSD-src-cb7f5ad55578fad7245152f0f9b7647830a53a2b.tar.gz |
Remove the syslog stuff, and allow various return values
in uu_lock(). Add uu_lockerr() for turning the results of
uu_lock into something printable. Remove bogus section in man page
about race conditions allowing both processes to get the lock.
Include libutil.h and use uu_lock() correctly where it should.
Suggested by: ache@freebsd.org
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r-- | usr.sbin/ppp/Makefile | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/modem.c | 13 |
2 files changed, 11 insertions, 6 deletions
diff --git a/usr.sbin/ppp/Makefile b/usr.sbin/ppp/Makefile index d28e543..4a2e2ba 100644 --- a/usr.sbin/ppp/Makefile +++ b/usr.sbin/ppp/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.16 1997/03/13 12:45:26 brian Exp $ +# $Id: Makefile,v 1.17 1997/03/30 12:12:20 brian Exp $ PROG= ppp SRCS= async.c auth.c ccp.c chap.c chat.c command.c filter.c fsm.c hdlc.c \ @@ -7,7 +7,7 @@ SRCS= async.c auth.c ccp.c chap.c chat.c command.c filter.c fsm.c hdlc.c \ vjcomp.c arp.c alias.c alias_db.c alias_ftp.c alias_util.c \ passwdauth.c sig.c #CFLAGS+= -DHAVE_SHELL_CMD_WITH_ANY_MODE -CFLAGS += -Wall -DUSE_PERROR -DMSEXT -DPASSWDAUTH +CFLAGS += -Wall -DMSEXT -DPASSWDAUTH LDADD += -lmd -lcrypt -lutil DPADD += ${LIBMD} ${LIBCRYPT} ${LIBUTIL} MAN8= ppp.8 diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c index e791776..074276a 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.30 1997/03/10 06:21:02 ache Exp $ + * $Id: modem.c,v 1.31 1997/03/10 06:54:58 ache Exp $ * * TODO: */ @@ -28,6 +28,7 @@ #include <sys/tty.h> #include <errno.h> #include <time.h> +#include <libutil.h> #include "hdlc.h" #include "lcp.h" #include "ip.h" @@ -48,7 +49,6 @@ static int connect_count; static struct pppTimer ModemTimer; static char uucplock[10]; -extern int uu_lock(), uu_unlock(); extern void PacketMode(), TtyTermMode(), TtyCommandMode(); extern int TermMode; @@ -377,6 +377,7 @@ int mode; struct termios rstio; int oldflag; char *host, *cp, *port; + int res; mbits = 0; if (mode & MODE_DIRECT) { @@ -392,8 +393,12 @@ int mode; if (strncmp(VarDevice, "/dev", 4) == 0) { strncpy(uucplock, rindex(VarDevice, '/')+1,sizeof(uucplock)-1); uucplock[sizeof(uucplock)-1] = '\0'; - if (uu_lock(uucplock) < 0) { - LogPrintf(LOG_PHASE_BIT, "Modem %s is in use\n", VarDevice); + if ((res = uu_lock(uucplock)) != UU_LOCK_OK) { + if (res == UU_LOCK_INUSE) + LogPrintf(LOG_PHASE_BIT, "Modem %s is in use\n", VarDevice); + else + LogPrintf(LOG_PHASE_BIT, "Modem %s is in use: uu_lock: %s\n", + VarDevice, uu_lockerr(res)); return(-1); } modem = open(VarDevice, O_RDWR|O_NONBLOCK); |