svn commit: samba r7228 - in branches/SAMBA_4_0/source/lib/messaging: .

tridge at samba.org tridge at samba.org
Fri Jun 3 13:20:45 GMT 2005


Author: tridge
Date: 2005-06-03 13:20:45 +0000 (Fri, 03 Jun 2005)
New Revision: 7228

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7228

Log:
use socket_pending() instead of the direct ioctl in the messaging code

Modified:
   branches/SAMBA_4_0/source/lib/messaging/messaging.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/messaging/messaging.c
===================================================================
--- branches/SAMBA_4_0/source/lib/messaging/messaging.c	2005-06-03 13:20:08 UTC (rev 7227)
+++ branches/SAMBA_4_0/source/lib/messaging/messaging.c	2005-06-03 13:20:45 UTC (rev 7228)
@@ -166,21 +166,22 @@
 	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;



More information about the samba-cvs mailing list