lib/tsocket: workaround sockets not supporting FIONREAD
commit4f637ba7df5754130739c98aafd8bc6eb8e5b1c0
authorRalph Boehme <slow@samba.org>
Thu, 4 Feb 2016 14:35:06 +0000 (4 15:35 +0100)
committerKarolin Seeger <kseeger@samba.org>
Tue, 16 Feb 2016 08:32:11 +0000 (16 09:32 +0100)
tree5ca105463b12434cd64b7d3f415711ea52883021
parent6774af16ea9b9fecb797a6fae2668b589ee22dc2
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

(cherry picked from commit 574313a1e11d521ba3f7232ff0b4186b49658199)
lib/tsocket/tsocket_bsd.c