This is patch 3058645 from the patches DB:

  In version 5.4.1 in snmplib/snmpUnixDomain.c in the function
  netsnmp_unix_recv there is a recv call on a unix domain socket. This
  call has the potential of blocking, even though select returned the
  socket as ready to read.

  The flag MSG_DONTWAIT should be added as a parameter, so that clients
  using the snmp library don't end up in a blocking recv. The attached
  patch does this.

Though I wonder if MSG_DONTWAIT is defined on every OS or not.  I'd be
tempted to do that call iff [sic] it exists, otherwise stay with the ,0

diff -Naur net-snmp-5.4.1~dfsg/snmplib/snmpUnixDomain.c 
net-snmp-5.4.1~dfsg-patch/snmplib/snmpUnixDomain.c
--- net-snmp-5.4.1~dfsg/snmplib/snmpUnixDomain.c        2007-04-30 
12:07:13.000000000 +0200
+++ net-snmp-5.4.1~dfsg-patch/snmplib/snmpUnixDomain.c  2010-09-03 
10:38:55.000000000 +0200
@@ -134,7 +134,7 @@
             return -1;
         };
         while (rc < 0) {
-            rc = recv(t->sock, buf, size, 0);
+            rc = recv(t->sock, buf, size, MSG_DONTWAIT);
             if (rc < 0 && errno != EINTR) {
                 DEBUGMSGTL(("netsnmp_unix", "recv fd %d err %d (\"%s\")\n",
                             t->sock, errno, strerror(errno)));


-- 
Wes Hardaker
Please mail all replies to net-snmp-coders@lists.sourceforge.net

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to