s3: smbd: Fix FreeBSD sendfile() for SMB2. Ensure we don't spin on EAGAIN.
commit7bf15686b60c35c853ae469906baa7d5ed51e4b7
authorJeremy Allison <jra@samba.org>
Wed, 18 Jul 2018 22:44:34 +0000 (18 15:44 -0700)
committerKarolin Seeger <kseeger@samba.org>
Sat, 28 Jul 2018 04:16:16 +0000 (28 06:16 +0200)
tree512d35b1f620d21938f87e568901c30117863348
parentadb7d6a1f465dcf39e68cdaa3980a0bf65ca35b4
s3: smbd: Fix FreeBSD sendfile() for SMB2. Ensure we don't spin on EAGAIN.

For SMB2 the socket is set non-blocking. Ensure sendfile()
calls complete if they return EAGAIN by saving the socket state,
setting it blocking, doing the sendfile until completion and then
restoring the socket state.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13537

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 456e520a3be7e4b54f1f144324c3671b8f6e35ea)
source3/lib/sendfile.c