aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ecore_con
diff options
context:
space:
mode:
authorSrivardhan Hebbar <sri.hebbar@samsung.com>2015-03-18 15:33:19 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-03-18 15:37:09 +0100
commitb1f74c615a57115933ba86ca63bc2da7f3d44f0c (patch)
treec5abab717b1b9269cd6b6fb9f787df1cc38109eb /src/lib/ecore_con
parentevas: Evas_3d proxy example uses cube primitives. (diff)
downloadefl-b1f74c615a57115933ba86ca63bc2da7f3d44f0c.tar.gz
ecore_con: fix ECORE_CON_LOCAL_SYSTEM use with negative port number.
Summary: The socket can be created even with negative port number, but in that case the port is ignored so that you can connect to non Ecore_Con based IPC. This patch remove that test to make the client and server match. @fix Bug: While creating ECORE_CON_LOCAL_SYSTEM server and client pair, when the socket name was "test_socket" and port number "-8" (Any negative number). Then while creating listening socket, the code would go to line no 291 and socket is created in tmp by ".ecore_servicetest_socket|-8". When the same is passed to bind then the code would go to line 118 and the socket it would try to bind would be ".ecore_servicetest_socket" !! So the bind would fail. Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com> Reviewers: cedric Reviewed By: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2186 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/lib/ecore_con')
-rw-r--r--src/lib/ecore_con/ecore_con_local.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/lib/ecore_con/ecore_con_local.c b/src/lib/ecore_con/ecore_con_local.c
index 2992058ee1..9af5ca56f1 100644
--- a/src/lib/ecore_con/ecore_con_local.c
+++ b/src/lib/ecore_con/ecore_con_local.c
@@ -119,14 +119,11 @@ ecore_con_local_connect(Ecore_Con_Server *obj,
}
else
{
- if (svr->name[0] ==
- '/')
- snprintf(buf, sizeof(buf), "%s|%i", svr->name,
- svr->port);
+ if (svr->name[0] == '/')
+ snprintf(buf, sizeof(buf), "%s|%i", svr->name, svr->port);
else
snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s|%i",
- svr->name,
- svr->port);
+ svr->name, svr->port);
}
}
else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
@@ -273,26 +270,24 @@ ecore_con_local_listen(
else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM)
{
mask = 0;
- if (svr->name[0] == '/')
+ if (svr->port < 0)
{
- if (svr->port >= 0)
- snprintf(buf,
- sizeof(buf),
- "%s|%i",
- svr->name,
- svr->port);
+ if (svr->name[0] == '/')
+ {
+ strncpy(buf, svr->name, sizeof(buf) - 1);
+ buf[sizeof(buf) - 1] = 0;
+ }
else
- snprintf(buf,
- sizeof(buf),
- "%s",
- svr->name);
+ snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s", svr->name);
}
else
- snprintf(buf,
- sizeof(buf),
- "/tmp/.ecore_service|%s|%i",
- svr->name,
- svr->port);
+ {
+ if (svr->name[0] == '/')
+ snprintf(buf, sizeof(buf), "%s|%i", svr->name, svr->port);
+ else
+ snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s|%i",
+ svr->name, svr->port);
+ }
}
else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
{