summaryrefslogtreecommitdiff
path: root/sys/lib
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-15 08:07:53 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-15 08:07:53 +0000
commit3c25d6481132b470fe85e545e66fd506d285e5f4 (patch)
tree392c12c71c43d5448d55c140cdb4a698fec05cdf /sys/lib
parent99b3f8ab189f6092cce1ab74495cabbd36663f40 (diff)
from netbsd:
Make `time difference' a signed quantity explicitly. bzero entire structures instead of explicitly storing 0's.
Diffstat (limited to 'sys/lib')
-rw-r--r--sys/lib/libsa/net.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/sys/lib/libsa/net.c b/sys/lib/libsa/net.c
index eeda4018673..9aa1a739177 100644
--- a/sys/lib/libsa/net.c
+++ b/sys/lib/libsa/net.c
@@ -1,4 +1,4 @@
-/* $NetBSD: net.c,v 1.9 1995/09/23 17:14:40 thorpej Exp $ */
+/* $NetBSD: net.c,v 1.12 1995/12/13 23:38:10 pk Exp $ */
/*
* Copyright (c) 1992 Regents of the University of California.
@@ -105,9 +105,7 @@ sendudp(d, pkt, len)
/* Calculate checksum (must save and restore ip header) */
tip = *ip;
ui = (struct udpiphdr *)ip;
- ui->ui_next = 0;
- ui->ui_prev = 0;
- ui->ui_x1 = 0;
+ bzero(ui->ui_x1, sizeof(ui->ui_x1));
ui->ui_len = uh->uh_ulen;
uh->uh_sum = in_cksum(ui, len);
*ip = tip;
@@ -239,9 +237,7 @@ readudp(d, pkt, len, tleft)
/* Check checksum (must save and restore ip header) */
tip = *ip;
ui = (struct udpiphdr *)ip;
- ui->ui_next = 0;
- ui->ui_prev = 0;
- ui->ui_x1 = 0;
+ bzero(ui->ui_x1, sizeof(ui->ui_x1));
ui->ui_len = uh->uh_ulen;
if (in_cksum(ui, n) != 0) {
#ifdef NET_DEBUG
@@ -290,7 +286,8 @@ sendrecv(d, sproc, sbuf, ssize, rproc, rbuf, rsize)
register size_t rsize;
{
register ssize_t cc;
- register time_t t, tmo, tlast, tleft;
+ register time_t t, tmo, tlast;
+ long tleft;
#ifdef NET_DEBUG
if (debug)
@@ -302,7 +299,7 @@ sendrecv(d, sproc, sbuf, ssize, rproc, rbuf, rsize)
t = getsecs();
for (;;) {
if (tleft <= 0) {
- if (tmo == MAXTMO) {
+ if (tmo >= MAXTMO) {
errno = ETIMEDOUT;
return -1;
}