summaryrefslogtreecommitdiffstats
path: root/sbin
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
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')
-rw-r--r--sbin/slattach/slattach.c13
-rw-r--r--sbin/startslip/startslip.c8
2 files changed, 16 insertions, 5 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);
diff --git a/sbin/startslip/startslip.c b/sbin/startslip/startslip.c
index 90d928c..60d97e0 100644
--- a/sbin/startslip/startslip.c
+++ b/sbin/startslip/startslip.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: startslip.c,v 1.22 1997/02/22 14:33:20 peter Exp $
+ * $Id: startslip.c,v 1.23 1997/03/29 03:33:08 imp Exp $
*/
#ifndef lint
@@ -60,6 +60,7 @@ static char sccsid[] = "@(#)startslip.c 8.1 (Berkeley) 6/5/93";
#include <termios.h>
#include <time.h>
#include <unistd.h>
+#include <libutil.h>
#include <netinet/in.h>
#include <net/if.h>
@@ -289,7 +290,10 @@ restart:
}
printd("open");
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, "%s: can't lock %s", username, devicename);
goto restart;
}
OpenPOWER on IntegriCloud