tsocket/bsd: fix bug #7115 FreeBSD includes the UDP header in FIONREAD
authorStefan Metzmacher <metze@samba.org>
Wed, 17 Feb 2010 12:53:02 +0000 (13:53 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 17 Feb 2010 13:46:39 +0000 (14:46 +0100)
metze

lib/tsocket/tsocket_bsd.c

index 13680ec0c54793d71cc8bbb0d777f3f84155a9db..9027bc97114f0b10286ede18b416f2ead919bc96 100644 (file)
@@ -883,10 +883,12 @@ static void tdgram_bsd_recvfrom_handler(void *private_data)
                return;
        }
 
-       if (ret != state->len) {
-               tevent_req_error(req, EIO);
-               return;
-       }
+       /*
+        * some systems too much bytes in tsocket_bsd_pending()
+        * the return value includes some IP/UDP header bytes
+        */
+       state->len = ret;
+       talloc_realloc(state, state->buf, uint8_t, ret);
 
        tevent_req_done(req);
 }