diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-06-03 13:20:45 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:17:28 -0500 |
commit | a8feef8d3647d25b3f5f572139acb1bab361055e (patch) | |
tree | ca40c69c62bd8bb6a3c2edba0b4230ff54eb47ec | |
parent | 1692bbf2e267eabd7099f0b6153da0c7cf209d1d (diff) | |
download | samba-a8feef8d3647d25b3f5f572139acb1bab361055e.tar.gz samba-a8feef8d3647d25b3f5f572139acb1bab361055e.tar.bz2 samba-a8feef8d3647d25b3f5f572139acb1bab361055e.zip |
r7228: use socket_pending() instead of the direct ioctl in the messaging code
(This used to be commit ca3c4e961713ffd8952fca328e27196ba2ccc0c9)
-rw-r--r-- | source4/lib/messaging/messaging.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index eb526fd391..936e3b9515 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -166,21 +166,22 @@ static void messaging_recv_handler(struct messaging_context *msg) NTSTATUS status; DATA_BLOB packet; size_t msize; - int dsize=0; /* see how many bytes are in the next packet */ - if (ioctl(socket_get_fd(msg->sock), FIONREAD, &dsize) != 0) { - DEBUG(0,("FIONREAD failed in messaging - %s\n", strerror(errno))); + status = socket_pending(msg->sock, &msize); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("socket_pending failed in messaging - %s\n", + nt_errstr(status))); return; } - packet = data_blob_talloc(msg, NULL, dsize); + packet = data_blob_talloc(msg, NULL, msize); if (packet.data == NULL) { /* assume this is temporary and retry */ return; } - status = socket_recv(msg->sock, packet.data, dsize, &msize, 0); + status = socket_recv(msg->sock, packet.data, msize, &msize, 0); if (!NT_STATUS_IS_OK(status)) { data_blob_free(&packet); return; |