summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-11-27 13:31:10 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-11-27 13:31:10 +0000
commitee4c57309394d460bd28dd03faec03383bb2ca93 (patch)
tree00d0624c03da58bdab55c6e8384e2ef28e2e7737
parent3c41d03e944324ca0c14840401f7793e64b9ae1c (diff)
fix an underflow in socket timeout calculations.
(see http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/32827). itojun@ ok
-rw-r--r--sys/kern/uipc_socket.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index cfbb7413c68..c23b7f07ee4 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.46 2002/08/08 19:18:12 provos Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.47 2002/11/27 13:31:09 mickey Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -1084,6 +1084,8 @@ sosetopt(so, level, optname, m0)
goto bad;
}
val = tv->tv_sec * hz + tv->tv_usec / tick;
+ if (val == 0 && tv->tv_usec != 0)
+ val = 1;
switch (optname) {