linux(4): Fix SO_LINGER l_onoff value
On Linux l_onoff should be 1 when linger is used. MFC after: 2 weeks
This commit is contained in:
parent
e92b9a9eaa
commit
e8d9d8082b
@ -1992,6 +1992,22 @@ linux_getsockopt_so_peersec(struct thread *td,
|
||||
len, args));
|
||||
}
|
||||
|
||||
static int
|
||||
linux_getsockopt_so_linger(struct thread *td,
|
||||
struct linux_getsockopt_args *args)
|
||||
{
|
||||
struct linger ling;
|
||||
socklen_t len;
|
||||
int error;
|
||||
|
||||
len = sizeof(ling);
|
||||
error = kern_getsockopt(td, args->s, SOL_SOCKET,
|
||||
SO_LINGER, &ling, UIO_SYSSPACE, &len);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
ling.l_onoff = ((ling.l_onoff & SO_LINGER) != 0);
|
||||
return (linux_sockopt_copyout(td, &ling, len, args));
|
||||
}
|
||||
|
||||
int
|
||||
linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args)
|
||||
@ -2075,6 +2091,9 @@ linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args)
|
||||
return (linux_sockopt_copyout(td, &newval,
|
||||
len, args));
|
||||
/* NOTREACHED */
|
||||
case SO_LINGER:
|
||||
return (linux_getsockopt_so_linger(td, args));
|
||||
/* NOTREACHED */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user