Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/kern/uipc_socket.c,v retrieving revision 1.181 retrieving revision 1.182 diff -u -p -r1.181 -r1.182 --- src/sys/kern/uipc_socket.c 2009/01/14 23:28:23 1.181 +++ src/sys/kern/uipc_socket.c 2009/01/15 15:25:37 1.182 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_socket.c,v 1.181 2009/01/14 23:28:23 christos Exp $ */ +/* $NetBSD: uipc_socket.c,v 1.182 2009/01/15 15:25:37 christos Exp $ */ /*- * Copyright (c) 2002, 2007, 2008 The NetBSD Foundation, Inc. @@ -63,7 +63,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.181 2009/01/14 23:28:23 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.182 2009/01/15 15:25:37 christos Exp $"); #include "opt_compat_netbsd.h" #include "opt_sock_counters.h" @@ -1583,7 +1583,7 @@ sorflush(struct socket *so) static int sosetopt1(struct socket *so, const struct sockopt *sopt) { - int error = 0, optval, opt; + int error = EINVAL, optval, opt; struct linger l; struct timeval tv; @@ -1692,14 +1692,14 @@ sosetopt1(struct socket *so, const struc error = sockopt_get(sopt, &otv, sizeof(otv)); timeval50_to_timeval(&otv, &tv); opt = opt == SO_OSNDTIMEO ? SO_SNDTIMEO : SO_RCVTIMEO; - error = 1; + error = 0; /*FALLTHROUGH*/ } #endif /* COMPAT_50 */ case SO_SNDTIMEO: case SO_RCVTIMEO: - if (error == 0) + if (error) error = sockopt_get(sopt, &tv, sizeof(tv)); solock(so); if (error)