From 687d0cdeb381b9003bb907fac08f035be93d1d7f Mon Sep 17 00:00:00 2001 From: Brian Somers Date: Mon, 31 Mar 1997 22:51:00 +0000 Subject: 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 --- sbin/slattach/slattach.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'sbin/slattach') diff --git a/sbin/slattach/slattach.c b/sbin/slattach/slattach.c index ab38ffb75a96..506cad6cacae 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 @@ -61,6 +61,7 @@ static char rcsid[] = "$Id: slattach.c,v 1.25 1997/02/22 14:33:19 peter Exp $"; #include #include #include +#include #include #include @@ -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); -- cgit v1.3