diff options
author | Vladimir Davydov <vdavydov@parallels.com> | 2014-07-15 12:25:28 +0400 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2014-09-17 19:06:50 +0400 |
commit | 14e870b94f25ee268fc220766eadbf67b3a14557 (patch) | |
tree | 1e256ac0c55733cd6df7f7594642f7369d80d847 /Documentation/rapidio | |
parent | 4194b9700ce41ff2f7031aa0c6108c2539028ab5 (diff) | |
download | linux-14e870b94f25ee268fc220766eadbf67b3a14557.tar.xz |
Bluetooth: never linger on process exit
commit 093facf3634da1b0c2cc7ed106f1983da901bbab upstream.
If the current process is exiting, lingering on socket close will make
it unkillable, so we should avoid it.
Reproducer:
#include <sys/types.h>
#include <sys/socket.h>
#define BTPROTO_L2CAP 0
#define BTPROTO_SCO 2
#define BTPROTO_RFCOMM 3
int main()
{
int fd;
struct linger ling;
fd = socket(PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
//or: fd = socket(PF_BLUETOOTH, SOCK_DGRAM, BTPROTO_L2CAP);
//or: fd = socket(PF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_SCO);
ling.l_onoff = 1;
ling.l_linger = 1000000000;
setsockopt(fd, SOL_SOCKET, SO_LINGER, &ling, sizeof(ling));
return 0;
}
Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'Documentation/rapidio')
0 files changed, 0 insertions, 0 deletions