Author: adrian.chadd
Date: Mon Jun 29 22:00:22 2009
New Revision: 14104

Modified:
    branches/LUSCA_HEAD/libiapp/comm.c

Log:
Correctly report the local socket address/port info during commBind()



Modified: branches/LUSCA_HEAD/libiapp/comm.c
==============================================================================
--- branches/LUSCA_HEAD/libiapp/comm.c  (original)
+++ branches/LUSCA_HEAD/libiapp/comm.c  Mon Jun 29 22:00:22 2009
@@ -162,14 +162,19 @@
  int
  commBind(int s, sqaddr_t *addr)
  {
+    int r;
+
      LOCAL_ARRAY(char, ip_buf, MAX_IPSTRLEN);
-    LOCAL_ARRAY(char, srv_buf, MAX_IPSTRLEN);
      CommStats.syscalls.sock.binds++;
      if (bind(s, sqinet_get_entry(addr), sqinet_get_length(addr)) == 0)
        return COMM_OK;
-    getnameinfo(sqinet_get_entry(addr), sqinet_get_family(addr),
-      ip_buf, MAX_IPSTRLEN, srv_buf, MAX_IPSTRLEN, NI_NUMERICHOST| 
NI_NUMERICSERV);
-    debug(5, 0) ("commBind: Cannot bind socket FD %d to %s port %s: %s\n",  
s, ip_buf, srv_buf, xstrerror());
+    r = sqinet_ntoa(addr, ip_buf, MAX_IPSTRLEN, 0);
+    if (r)
+        debug(5, 0) ("commBind: Cannot bind socket FD %d family %d to %s  
port %d: %s\n",
+          s, sqinet_get_family(addr), ip_buf, sqinet_get_port(addr),  
xstrerror());
+    else
+        debug(5, 0) ("commBind: Cannot bind socket FD %d family %d: %s\n",
+          s, sqinet_get_family(addr), xstrerror());
      return COMM_ERROR;
  }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to