Update of /cvsroot/monetdb/sql/src/backends/monet5/merovingian
In directory 
sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17745/src/backends/monet5/merovingian

Modified Files:
        merovingian_client.c 
Log Message:
propagated changes of Friday Mar 05 2010 - Wednesday Mar 10 2010
from the Feb2010 branch to the development trunk

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2010/03/05 - mr-meltdown:
          src/backends/monet5/merovingian/merovingian_client.c,1.2.2.1
  Fix bug #2964247, thanks Sjoerd for debugging.
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Index: merovingian_client.c
===================================================================
RCS file: 
/cvsroot/monetdb/sql/src/backends/monet5/merovingian/merovingian_client.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- merovingian_client.c        7 Jan 2010 15:24:31 -0000       1.2
+++ merovingian_client.c        10 Mar 2010 14:29:42 -0000      1.3
@@ -227,23 +227,22 @@
                                strerror(errno));
                host = "(unknown)";
        } else {
-               /* avoid doing this, it requires some includes that probably
-                * give trouble on windowz
-               host = inet_ntoa(saddr.sin_addr);
-                */
+               size_t len;
                struct hostent *hoste = 
                        gethostbyaddr(&saddr.sin_addr.s_addr, 4, 
saddr.sin_family);
                if (hoste == NULL) {
-                       host = alloca(sizeof(char) * ((3 + 1 + 3 + 1 + 3 + 1 + 
3) + 1));
-                       sprintf(host, "%u.%u.%u.%u:%u",
+                       len = (3 + 1 + 3 + 1 + 3 + 1 + 3 + 1 + 5) + 1;
+                       host = alloca(sizeof(char) * len);
+                       snprintf(host, len, "%u.%u.%u.%u:%u",
                                        (unsigned) 
((ntohl(saddr.sin_addr.s_addr) >> 24) & 0xff),
                                        (unsigned) 
((ntohl(saddr.sin_addr.s_addr) >> 16) & 0xff),
                                        (unsigned) 
((ntohl(saddr.sin_addr.s_addr) >> 8) & 0xff),
                                        (unsigned) 
(ntohl(saddr.sin_addr.s_addr) & 0xff),
                                        (unsigned) (ntohs(saddr.sin_port)));
                } else {
-                       host = alloca(sizeof(char) * (strlen(hoste->h_name) + 1 
+ 5 + 1));
-                       sprintf(host, "%s:%u",
+                       len = strlen(hoste->h_name) + 1 + 5 + 1;
+                       host = alloca(sizeof(char) * len);
+                       snprintf(host, len, "%s:%u",
                                        hoste->h_name, (unsigned) 
(ntohs(saddr.sin_port)));
                }
        }


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to