summaryrefslogtreecommitdiffstats
path: root/sbin/slattach/slattach.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-03-31 22:51:00 +0000
committerbrian <brian@FreeBSD.org>1997-03-31 22:51:00 +0000
commitcb7f5ad55578fad7245152f0f9b7647830a53a2b (patch)
tree2c78d1ecaf1cdd58a514ff6e9ba36cc4bc7becdf /sbin/slattach/slattach.c
parent8871c2899e1277da4a3d19c3cbbc4d2fae060306 (diff)
downloadFreeBSD-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 'sbin/slattach/slattach.c')
-rw-r--r--sbin/slattach/slattach.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sbin/slattach/slattach.c b/sbin/slattach/slattach.c
index ab38ffb..506cad6 100644
--- a/sbin/slattach/slattach.c
+++ b/sbin/slattach/slattach.c
@@ -42,7 +42,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)slattach.c 4.6 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$Id: slattach.c,v 1.25 1997/02/22 14:33:19 peter Exp $";
+static char rcsid[] = "$Id: slattach.c,v 1.26 1997/03/29 03:33:07 imp Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -61,6 +61,7 @@ static char rcsid[] = "$Id: slattach.c,v 1.25 1997/02/22 14:33:19 peter Exp $";
#include <syslog.h>
#include <termios.h>
#include <unistd.h>
+#include <libutil.h>
#include <netinet/in.h>
#include <net/if.h>
@@ -294,7 +295,10 @@ void acquire_line()
if (uucp_lock) {
/* unlock not needed here, always re-lock with new pid */
- if (uu_lock(dvname)) {
+ int res;
+ if ((res = uu_lock(dvname)) != UU_LOCK_OK) {
+ if (res != UU_LOCK_INUSE)
+ syslog(LOG_ERR, "uu_lock: %s", uu_lockerr(res));
syslog(LOG_ERR, "can't lock %s", dev);
exit_handler(1);
}
@@ -474,7 +478,10 @@ again:
if (system(redial_cmd))
goto again;
if (uucp_lock) {
- if (uu_lock(dvname)) {
+ int res;
+ if ((res = uu_lock(dvname)) != UU_LOCK_OK) {
+ if (res != UU_LOCK_INUSE)
+ syslog(LOG_ERR, "uu_lock: %s", uu_lockerr(res));
syslog(LOG_ERR, "can't relock %s after %s, aborting",
dev, redial_cmd);
exit_handler(1);
OpenPOWER on IntegriCloud