Changeset: 1833c58f20c5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1833c58f20c5
Modified Files:
        clients/src/mapilib/Mapi.mx
Branch: Jun2010
Log Message:

if a UNIX socket isn't going to fly, then don't even try it, just fall back to 
a regular TCP connection instead (this is only in case of default behaviour)


diffs (17 lines):

diff -r ab675d79f102 -r 1833c58f20c5 clients/src/mapilib/Mapi.mx
--- a/clients/src/mapilib/Mapi.mx       Mon Jul 26 19:53:05 2010 +0200
+++ b/clients/src/mapilib/Mapi.mx       Mon Jul 26 20:31:31 2010 +0200
@@ -2339,9 +2339,12 @@
 #ifdef HAVE_SYS_UN_H
        if (mid->hostname == NULL) {
                struct stat st;
+               struct sockaddr_un s; /* just for sizeof(s.sun_path) */ (void)s;
                snprintf(errbuf, sizeof(errbuf),
                         CLIENTS_PREFIX "/var/MonetDB5/dbfarm/mapi_socket");
-               if (stat(errbuf, &st) != 1 && S_ISSOCK(st.st_mode))
+               if (strlen(errbuf) <= sizeof(s.sun_path) &&
+                               stat(errbuf, &st) != 1 &&
+                               S_ISSOCK(st.st_mode))
                        mid->hostname = strdup(errbuf);
        }
        if (mid->hostname && mid->hostname[0] == '/') {
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to