lib/tsocket: workaround sockets not supporting FIONREAD
authorRalph Boehme <slow@samba.org>
Thu, 4 Feb 2016 14:35:06 +0000 (15:35 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 10 Feb 2016 09:30:23 +0000 (10:30 +0100)
commit574313a1e11d521ba3f7232ff0b4186b49658199
tree8e03c50b0941daa07191985038c2023e5f07fda4
parent1d26012ce84d12cba236e5a88be25e6d489c9144
lib/tsocket: workaround sockets not supporting FIONREAD

Netlink sockets don't support querying pending bytes with ioctl(fd,
FIONREAD, ...) and would return EOPNOTSUPP, so use recvmsg() with
MSG_PEEK|MSG_TRUNC as a fallback.

The MSG_TRUNC flag to recvmsg() is Linux only, but netlink is as well,
so we're safe for now.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11714

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Feb 10 10:30:24 CET 2016 on sn-devel-144
lib/tsocket/tsocket_bsd.c