summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1998-02-15 15:51:49 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1998-02-15 15:51:49 +0000
commit69610abb4918feb6cc803c767885ba8ff78fbf24 (patch)
tree73d1d709948489dc8fd9a7e3efb342dce96922b5 /usr.sbin
parent127a3e6eb73838d98b5ce084655984ed98554cf5 (diff)
Use keepalives as the protocol never notices if a networked printer
dies.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/lpr/common_source/common.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c
index 13df6931499..07da9b3240f 100644
--- a/usr.sbin/lpr/common_source/common.c
+++ b/usr.sbin/lpr/common_source/common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: common.c,v 1.7 1997/07/25 20:12:11 mickey Exp $ */
+/* $OpenBSD: common.c,v 1.8 1998/02/15 15:51:48 niklas Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)common.c 8.5 (Berkeley) 4/28/95";
#else
-static char rcsid[] = "$OpenBSD: common.c,v 1.7 1997/07/25 20:12:11 mickey Exp $";
+static char rcsid[] = "$OpenBSD: common.c,v 1.8 1998/02/15 15:51:48 niklas Exp $";
#endif
#endif /* not lint */
@@ -137,7 +137,7 @@ getport(rhost, rport)
struct hostent *hp;
struct servent *sp;
struct sockaddr_in sin;
- int s, timo = 1, lport = IPPORT_RESERVED - 1;
+ int s, timo = 1, on = 1, lport = IPPORT_RESERVED - 1;
int err;
/*
@@ -187,6 +187,9 @@ retry:
}
return(-1);
}
+
+ /* Don't bother if we get an error here. */
+ setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (char *)&on, sizeof on);
return(s);
}