From 5f540404a834648943b87ee0f15f8724919f5263 Mon Sep 17 00:00:00 2001 From: Garrett Wollman Date: Thu, 16 Feb 1995 01:07:43 +0000 Subject: [PATCH] getsockopt(s, SOL_SOCKET, SO_SNDTIMEO, ...) would construct the returned timeval incorrectly, truncating the usec part. Obtained from: Stevens vol. 2 p. 548 --- sys/kern/uipc_socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 277ce5281a81..5e3bd9798ea3 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94 - * $Id: uipc_socket.c,v 1.7 1995/02/06 02:22:12 davidg Exp $ + * $Id: uipc_socket.c,v 1.8 1995/02/07 02:01:14 wollman Exp $ */ #include @@ -1029,7 +1029,7 @@ sogetopt(so, level, optname, mp) m->m_len = sizeof(struct timeval); mtod(m, struct timeval *)->tv_sec = val / hz; mtod(m, struct timeval *)->tv_usec = - (val % hz) / tick; + (val % hz) * tick; break; }