Enlightenment CVS committal

Author  : sebastid
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore_con


Modified Files:
        ecore_con.c 


Log Message:
Make it possible to connect to systems which do not use ports for local
sockets.

===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_con/ecore_con.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -3 -r1.77 -r1.78
--- ecore_con.c 10 Jul 2006 19:11:55 -0000      1.77
+++ ecore_con.c 20 Jul 2006 16:47:02 -0000      1.78
@@ -387,7 +387,6 @@
    char                buf[4096];
 
    if (!name) return NULL;
-   if (port < 0) return NULL;
    /* local  user   socket: FILE:   ~/.ecore/[name]/[port] */
    /* local  system socket: FILE:   /tmp/.ecore_service|[name]|[port] */
    /* remote system socket: TCP/IP: [name]:[port] */
@@ -399,6 +398,7 @@
    /* unset the SSL flag for the following checks */
    type &= ~ECORE_CON_USE_SSL;
 #endif
+   if ((type == ECORE_CON_REMOTE_SYSTEM) && (port < 0)) return NULL;
 
    if ((type == ECORE_CON_LOCAL_USER) ||
        (type == ECORE_CON_LOCAL_SYSTEM))
@@ -414,10 +414,20 @@
          }
        else if (type == ECORE_CON_LOCAL_SYSTEM)
          {
-            if (name[0] == '/')
-              snprintf(buf, sizeof(buf), "%s|%i", name, port);
+            if (port < 0)
+              {
+                 if (name[0] == '/')
+                   strncpy(buf, name, sizeof(buf));
+                 else
+                   snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s", name);
+              }
             else
-              snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s|%i", name, 
port);
+              {
+                 if (name[0] == '/')
+                   snprintf(buf, sizeof(buf), "%s|%i", name, port);
+                 else
+                   snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s|%i", 
name, port);
+              }
          }
        svr->fd = socket(AF_UNIX, SOCK_STREAM, 0);
        if (svr->fd < 0) goto error;



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to